Re: [Bpf] BPF ISA conformance groups
Alexei Starovoitov <alexei.starovoitov@gmail.com> Sun, 10 December 2023 03:10 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 774CCC15152E for <bpf@ietfa.amsl.com>; Sat, 9 Dec 2023 19:10:51 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.108
X-Spam-Level:
X-Spam-Status: No, score=-2.108 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_NONE=-0.0001, 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 alE1t7K5EV4C for <bpf@ietfa.amsl.com>; Sat, 9 Dec 2023 19:10:47 -0800 (PST)
Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) (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 E96A0C15109E for <bpf@ietf.org>; Sat, 9 Dec 2023 19:10:46 -0800 (PST)
Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-40b27726369so37189895e9.0 for <bpf@ietf.org>; Sat, 09 Dec 2023 19:10:46 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702177845; x=1702782645; 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=hIksy3SQTBUBARta9D9fpak30NF+hUQgyMPS+9iDm/8=; b=M+43UDbvzx3dNN2Z/GXXGjIwtbG8jT1cjObSD5zt89b2fAOxDJNLWH0cwpnJSPOC2i /M6/E/UJupxvuCw7eCrKeAAwQh2GQ93mj0IqMu1DUa/AFGMLqeRLyutOPkhbGWRGRk+f uLKuVSB7lKzU7x9LQr27MQdoOsqValJLnKs9CybQxyUHcpqNEGM6AtG5bJJw38SrOHaC VjCiX2M7tKgftyl78uP3NBkAkaU7JjRSPXovgINfpiF/bCdZtM7/5nQm/O7ZcDt/s8ye T5qZHSSjgkem0f+kvMy9ihZXDrrrE28Kk4mBpJkQ82ddIgMyG+o9dvhyc3HLsfBOtvgW D2HA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702177845; x=1702782645; 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=hIksy3SQTBUBARta9D9fpak30NF+hUQgyMPS+9iDm/8=; b=Amoikrv3En7kVOfpseoA4LRyjit8Bl32Uc+czYW0B5hzvPFQ30milyRCjB47S0c7x0 SklpmePYJO7pOXHRQJRFbRlfZBW5YKh6L6q1TsriODqx5o2ETwZsv4ePcePkQ22mottW s3VG5QKfq9MMWua6+tNfTUNYwz7oJieaTbmUa9DAC2w8LKQOVfoLlVftQZv8ZoRclGBp aqbX1LoamaMHjdYFSYDBmPt2BhbkdYGsNVQoCdhvtqnr/rtHWCw8GSZ1TdkBDEThXWLl Z5ldMziL1rMSGmyMz4U9jLoO/g0SJfmJFO99IeraUNgXOBq0WJTxVpk20tinlNn21gQJ 9s4A==
X-Gm-Message-State: AOJu0YzxvlFfq8SJmz3LkUjhFTrp6A0+YElJMUoOaKuNRAV1gCKnXr2u xLm3hKoWOgA4KQLU5pCGMbdljyDwzJfL/I17Y3WobFrX
X-Google-Smtp-Source: AGHT+IHG7+fwvr9GYUZJ4DPY02szyiNOUhDwcZzNYUye5guoD8UtqXxCrgnYb32ceF/YYe/ZxuY/PC+5zbP7xynHSA8=
X-Received: by 2002:a05:600c:3784:b0:40b:5e21:e27b with SMTP id o4-20020a05600c378400b0040b5e21e27bmr1234528wmr.104.1702177845234; Sat, 09 Dec 2023 19:10:45 -0800 (PST)
MIME-Version: 1.0
References: <20231127201817.GB5421@maniforge> <072101da2558$fe5f5020$fb1df060$@gmail.com> <20231207215152.GA168514@maniforge>
In-Reply-To: <20231207215152.GA168514@maniforge>
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Date: Sat, 09 Dec 2023 19:10:33 -0800
Message-ID: <CAADnVQ+Mhe6ean6J3vH1ugTyrgWNxupLoFfwKu6-U=3R8i1TNQ@mail.gmail.com>
To: David Vernet <void@manifault.com>
Cc: Dave Thaler <dthaler1968=40googlemail.com@dmarc.ietf.org>, Christoph Hellwig <hch@infradead.org>, bpf@ietf.org, bpf <bpf@vger.kernel.org>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/bpf/_CViBgpJOIQM0fvKcHWQCpCRFvg>
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: Sun, 10 Dec 2023 03:10:51 -0000
On Thu, Dec 7, 2023 at 1:51 PM David Vernet <void@manifault.com> wrote: > > On Sat, Dec 02, 2023 at 11:51:50AM -0800, dthaler1968=40googlemail.com@dmarc.ietf.org wrote: > > >From David Vernet's WG summary: > > > After this update, the discussion moved to a topic for the BPF ISA > > document that has yet to be resolved: > > > ISA RFC compliance. Dave pointed out that we still need to specify which > > instructions in the ISA are > > > MUST, SHOULD, etc, to ensure interoperability. Several different options > > were presented, including > > > having individual-instruction granularity, following the clang CPU > > versioning convention, and grouping > > > instructions by logical functionality. > > > > > > We did not obtain consensus at the conference on which was the best way > > forward. Some of the points raised include the following: > > > > > > - Following the clang CPU versioning labels is somewhat arbitrary. It > > > may not be appropriate to standardize around grouping that is a result > > > of largely organic historical artifacts. > > > - If we decide to do logical grouping, there is a danger of > > > bikeshedding. Looking at anecdotes from industry, some vendors such as > > > Netronome elected to not support particular instructions for > > > performance reasons. > > > > My sense of the feedback in general was to group instructions by logical > > functionality, and only create separate > > conformance groups where there is some legitimate technical reason that a > > runtime might not want to support > > a given set of instructions. Based on discussion during the meeting, here's > > a strawman set of conformance > > groups to kick off discussion. I've tried to use short (like 6 characters > > or fewer) names for ease of display in > > document tables, and potentially in command line options to tools that might > > want to use them. > > > > A given runtime platform would be compliant to some set of the following > > conformance groups: > > > > 1. "basic": all instructions not covered by another group below. > > 2. "atomic": all Atomic operations. I think Christoph argued for this one > > in the meeting. > > 3. "divide": all division and modulo operations. Alexei said in the meeting > > that he'd heard demand for this one. > > 4. "legacy": all legacy packet access instructions (deprecated). > > 5. "map": 64-bit immediate instructions that deal with map fds or map > > indices. > > 6. "code": 64-bit immediate instruction that has a "code pointer" type. > > 7. "func": program-local functions. > > I thought for a while about whether this should be part of the basic > conformance group, and talked through it with Jakub Kicinski. I do think > it makes sense to keep it separate like this. For e.g. devices with > Harvard architectures, it could get quite non-trivial for the verifier > to determine whether accesses to arguments stored in special register > are safe. Definitely not impossible, and overall very useful to support > this, but in order to ease vendor adoption it's probably best to keep > this separate. > > > Things that I *think* don't need a separate conformance group (can just be > > in "basic") include: > > a. Call helper function by address or BTF ID. A runtime that doesn't > > support these simply won't expose any > > such helper functions to BPF programs. > > b. Platform variable instructions (dst = var_addr(imm)). A runtime that > > doesn't support this simply won't > > expose any platform variables to BPF programs. > > > > Comments? (Let the bikeshedding begin...) > > This list seems logical to me, I think we should do just two categories: legacy and the rest, since any scheme will be flawed and infinite bikeshedding will ensue. For example, let's take a look at #2 atomic... Should it include or exclude atomic_add insn ? It was added at the very beginning of BPF ISA and was used from day one. Without it it's impossible to count stats. The typical network or tracing use case needs to count events and one cannot do it without atomic increment. Eventually per-cpu maps were added as an alternative. I suspect any platform that supports #1 basic insn without atomic_add will not be practically useful. Should atomic_add be a part of "basic" then? But it's atomic. Then what about atomic_fetch_add insn? It's pretty close semantically. Part of atomic or part of basic? Another example, #3 divide. bpf cpu=v1 ISA only has unsigned div/mod. Eventually we added a signed version. Integer division is one of the slowest operations in a HW. Different cpus have different flavors of them 64/32 64/64 32/32, etc. All with different quirks. cpu=v1 had modulo insn because in tracing one often needs to do it to select a slot in a table, but in networking there is rarely a need. So bpf offload into netronome HW doesn't support it (iirc). Should div/mod signed/unsigned be a part of basic? or separate? Only 32 or 64 bit? Hence my point: legacy and the rest (as of cpu=v4) are the only two categories we should have in _this_ version of the standard. Rest assured we will add new insn in the coming months. I suggest we figure out conformance groups for future insns at that time. That would be the time to argue and actually extract value out of discussion. Retroactive bike shedding is a bike shedding and nothing else.
- Re: [Bpf] BPF ISA conformance groups David Vernet
- [Bpf] IETF 118 BPF WG summary David Vernet
- Re: [Bpf] IETF 118 BPF WG summary Michael Richardson
- [Bpf] BPF ISA conformance groups dthaler1968
- Re: [Bpf] BPF ISA conformance groups Alexei Starovoitov
- Re: [Bpf] BPF ISA conformance groups Watson Ladd
- Re: [Bpf] BPF ISA conformance groups David Vernet
- Re: [Bpf] BPF ISA conformance groups dthaler1968
- Re: [Bpf] BPF ISA conformance groups Alexei Starovoitov
- Re: [Bpf] BPF ISA conformance groups David Vernet
- Re: [Bpf] BPF ISA conformance groups Alexei Starovoitov
- Re: [Bpf] BPF ISA conformance groups David Vernet
- Re: [Bpf] BPF ISA conformance groups Christoph Hellwig
- Re: [Bpf] BPF ISA conformance groups Alexei Starovoitov
- Re: [Bpf] BPF ISA conformance groups David Vernet
- Re: [Bpf] BPF ISA conformance groups Christoph Hellwig
- Re: [Bpf] BPF ISA conformance groups Alexei Starovoitov
- Re: [Bpf] BPF ISA conformance groups dthaler1968
- Re: [Bpf] BPF ISA conformance groups Alexei Starovoitov
- Re: [Bpf] BPF ISA conformance groups Christoph Hellwig
- Re: [Bpf] BPF ISA conformance groups David Vernet
- Re: [Bpf] BPF ISA conformance groups Alexei Starovoitov
- Re: [Bpf] BPF ISA conformance groups Jose E. Marchesi
- Re: [Bpf] BPF ISA conformance groups David Vernet
- Re: [Bpf] BPF ISA conformance groups dthaler1968
- Re: [Bpf] BPF ISA conformance groups dthaler1968
- Re: [Bpf] BPF ISA conformance groups Alexei Starovoitov