Re: [Bpf] BPF ISA conformance groups

Alexei Starovoitov <alexei.starovoitov@gmail.com> Thu, 25 January 2024 02:56 UTC

Return-Path: <alexei.starovoitov@gmail.com>
X-Original-To: bpf@ietfa.amsl.com
Delivered-To: bpf@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id B27EDC14F71B for <bpf@ietfa.amsl.com>; Wed, 24 Jan 2024 18:56:00 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.107
X-Spam-Level:
X-Spam-Status: No, score=-2.107 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_BLOCKED=0.001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kqaMjchOiewD for <bpf@ietfa.amsl.com>; Wed, 24 Jan 2024 18:55:58 -0800 (PST)
Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 97731C14F6F3 for <bpf@ietf.org>; Wed, 24 Jan 2024 18:55:58 -0800 (PST)
Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-33931b38b65so3976596f8f.3 for <bpf@ietf.org>; Wed, 24 Jan 2024 18:55:58 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706151357; x=1706756157; darn=ietf.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=YbhGA0gDhCjRLVpsKiToXzQlCxMvHT4hJbqH0aQDeuI=; b=kCRrMvFJyTzYtvoTqLh5CH5hCu5pfOUPDcZTmh2PvDPd3Q1PDW2a/H9x5ay7/Iapuq 9mRYGjp3EKqFkvbcaXtIurBPDLYbZBz7G+hey3RetHmd24q4ch1KgyHKnSEOUfGLtHJd t+IMznLJIwU20jwnibat20Ye7yGgQgEWmq2bLqKkPL3V7Q2WUVd4BGIszGAkZyrCC6il R39C8teSASFVOr+pKyH1S/fqaYmNsTw5bRlzI2bh+7Le+ogh3Z1eP1IwvMTCu1EvD2er WYTOw3Q6+j3tZpAPRXQCQJNfRVNnolbb9IhIdw6jf2zqkEN710mn2QkXOKcqIFvprtA0 /ydw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706151357; x=1706756157; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YbhGA0gDhCjRLVpsKiToXzQlCxMvHT4hJbqH0aQDeuI=; b=umjETZdop0lZ0zRrQsaENBS7bycNP9yJaw/miFHkyRV9HwnvEZKyTmHC1GLHpYb7D+ 0B3bkeDo5p9fjoyg+K69yxoKmOpPJbV6HoaJcfdIEVWRoZNc9YBfOmljHBOovd4AiI4u YOz/vklH+p/FzJRPGVyU9nRJKFyZ2ea9H/y6tkOxivv8bf5z+wawxeaNFCmIQvwAwQJW 5CfZRqGtjouqmS2Jv1YnNpXvWvJhINm+k0xNDgbqX88BSAdXKW/gEE3eQ1RFkECvYdUz kbCmP4NEvBtIUmBYKk/IsoNiZv/WKI6SORaJ0jO8CFeWILP4xA4Cmygg0/RFpLa0Rmnp sOJQ==
X-Gm-Message-State: AOJu0YyS6KonLmxKc/lfQckUlFSIXqxfoNFO0+k6kequro5GlwUNfU+u cJLNluRiSLS+5fr5Vo+vHScCtCz7fIb4UX06wht1+LqMJSTmQ1nKNorX3mSdQz7Kt/vUSYKaHe6 kEaFuHwgw0F4hdu0PlyiIG42Bcunv5QTO
X-Google-Smtp-Source: AGHT+IE47PVU+SyIT0Gq5bH3DbX3L55aEhmnlU1Vd0psSXCvryuQERT+5x72Yf6bfGfxjYf8p7qoYgXao8sw8+iorwA=
X-Received: by 2002:a05:6000:510:b0:337:8db0:597d with SMTP id a16-20020a056000051000b003378db0597dmr86065wrf.116.1706151356977; Wed, 24 Jan 2024 18:55:56 -0800 (PST)
MIME-Version: 1.0
References: <20231214174437.GA2853@maniforge> <ZXvkS4qmRMZqlWhA@infradead.org> <CAADnVQ+ExRC_RavN_sbuOmuwyP6+HKnV9bFjJOseORBaVw0Jcg@mail.gmail.com> <09dc01da32a6$99c97e50$cd5c7af0$@gmail.com> <CAADnVQ+Kb20aUZdcqSh5eF-_dzpHWcpjAtYpLgg5Fqog=g7hpA@mail.gmail.com> <ZYPiq6ijLaMl/QD8@infradead.org> <20240105220711.GA1001999@maniforge> <ZZwcC7nZiZ+OV1ST@infradead.org> <CAADnVQLMo0M675T89gu9v_wSR+GbQmu4ajWjwgWK9aCNkJPsaQ@mail.gmail.com> <874jfm68ok.fsf@oracle.com> <20240123213948.GA221862@maniforge> <1f8301da4e54$0b0ad690$212083b0$@gmail.com>
In-Reply-To: <1f8301da4e54$0b0ad690$212083b0$@gmail.com>
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Date: Wed, 24 Jan 2024 18:55:45 -0800
Message-ID: <CAADnVQ+iN=HMdZD3jVhQxPzCWKi07DZo_wxq28nuC4JuXk2ZGw@mail.gmail.com>
To: Dave Thaler <dthaler1968@googlemail.com>
Cc: David Vernet <void@manifault.com>, "Jose E. Marchesi" <jose.marchesi@oracle.com>, Christoph Hellwig <hch@infradead.org>, bpf@ietf.org, bpf <bpf@vger.kernel.org>, Jakub Kicinski <kuba@kernel.org>, David Faust <david.faust@oracle.com>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/bpf/A--3VwJB82EMoEf2p4Uin8gNabk>
Subject: Re: [Bpf] BPF ISA conformance groups
X-BeenThere: bpf@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: Discussion of BPF/eBPF standardization efforts within the IETF <bpf.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/bpf>, <mailto:bpf-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/bpf/>
List-Post: <mailto:bpf@ietf.org>
List-Help: <mailto:bpf-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/bpf>, <mailto:bpf-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Jan 2024 02:56:00 -0000

On Tue, Jan 23, 2024 at 3:29 PM <dthaler1968@googlemail.com> wrote:
>
> > -----Original Message-----
> > From: David Vernet <void@manifault.com>
> > Sent: Tuesday, January 23, 2024 1:40 PM
> > To: Jose E. Marchesi <jose.marchesi@oracle.com>
> > Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>; Christoph Hellwig
> > <hch@infradead.org>; Dave Thaler <dthaler1968@googlemail.com>;
> > bpf@ietf.org; bpf <bpf@vger.kernel.org>; Jakub Kicinski <kuba@kernel.org>;
> > david.faust@oracle.com
> > Subject: Re: [Bpf] BPF ISA conformance groups
> >
> > On Tue, Jan 09, 2024 at 12:35:39PM +0100, Jose E. Marchesi wrote:
> > >
> > > > On Mon, Jan 8, 2024 at 8:00 AM Christoph Hellwig <hch@infradead.org>
> > wrote:
> > > >>
> > > >> On Fri, Jan 05, 2024 at 04:07:11PM -0600, David Vernet wrote:
> > > >> >
> > > >> > So how do we want to move forward here? It sounds like we're
> > > >> > leaning toward's Alexei's proposal of having:
> > > >> >
> > > >> > - Base Integer Instruction Set, 32-bit
> > > >> > - Base Integer Instruction Set, 64-bit
> > > >> > - Integer Multiplication and Division
> > > >> > - Atomic Instructions
> > > >>
> > > >> As in the 64-bit integer set would be an add-on to the first one
> > > >> which is the core set?  In that case that's fine with me, but the
> > > >> above wording is a bit suboptimal.
> > > >
> > > > yes.
> > > > Here is how I was thinking about the grouping:
> > > > 32-bit set: all 32-bit instructions those with BPF_ALU and BPF_JMP32
> > > > and load/store.
> > > >
> > > > 64-bit set: above plus BPF_ALU64 and BPF_JMP.
> > > >
> > > > The idea is to allow for clean 32-bit HW offloads.
> > > > We can introduce a compiler flag that will only use such
> > > > instructions and will error when 64-bit math is needed.
> > > > Details need to be thought through, of course.
> > > > Right now I'm not sure whether we need to reduce sizeof(void*) to 4
> > > > in such a case or normal 8 will still work, but from ISA perspective
> > > > everything is ready. 32-bit subregisters fit well.
> > > > The compiler work plus additional verifier smartness is needed, but
> > > > the end result should be very nice.
> > > > Offload of bpf programs into 32-bit embedded devices will be possible.
> > >
> > > This is very interesting.
> > this is necessarily something we need to figure out now. Hopefully this is all
> > stuff we can iron out once we start to really sink our teeth into the ABI doc.
>
> "Integer Multiplication and Division" in this thread doesn't seem to separate
> between 32-bit vs 64-bit.  Is the proposal that multiplication/division is ok
> to require 64-bit operations?  I had expected one rationale for the 32bit
> multiplication/division instructions is to accommodate 32-bit-only
> implementations.   So should we have separate groups for 32-bit vs
> 64-bit for the multiplication/division instructions?
>
> Similar question goes for the atomic instructions, i.e., should we
> have separate conformance groups for 32-bit vs 64-bit atomics?

risc-v defines only one group "M" for div/mul and another group "A"
for atomics.

What it means that groups "base32 + M" means that only 32-bit mul
is available while "base64 + M" means that both 32 and 64-bit alu is there.