Re: [Bpf] ISA: BPF_MSH and deprecated packet access instructions
Alexei Starovoitov <alexei.starovoitov@gmail.com> Tue, 30 January 2024 19:40 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 60496C14F726 for <bpf@ietfa.amsl.com>; Tue, 30 Jan 2024 11:40:42 -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 BgmMG_xSarov for <bpf@ietfa.amsl.com>; Tue, 30 Jan 2024 11:40:41 -0800 (PST)
Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) (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 E02B7C14F71D for <bpf@ietf.org>; Tue, 30 Jan 2024 11:40:41 -0800 (PST)
Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-5111e5e4e2bso1230327e87.3 for <bpf@ietf.org>; Tue, 30 Jan 2024 11:40:41 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706643640; x=1707248440; 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=yzRKimwqPjTIEeKQ1oM17JSZAsqV0NhKJRSyXCx6gfQ=; b=DndqOCplEirK9RL/xx4gOZF3Plsj8xjn8ZbcEC3zqSdF/4DgKhPFHujiAEflepmpAZ HLrJ+m2F+DYcdF4x0mJbHyhswj01OJwYUdDNcpJSY5cW0vJFwJEOCMNxugjr5fl5W1/t QHC03HeAoZJ11bkXBcvDr3zewbVeu9T9lAV38J1OLQsCxICn8w1TrT5Y9evICv7oWmAB juDixYa5dTeeIwHqB4yq8Q9wA0yHogtU4b3xMny2OIJCVHU90AsPVLudUVbfRv38zy7T P21siIAv9M/+UOuiQsWpg/r0m0GJ69X5EIpS6GEmrTB3UZY368Yu+OrWf/4SLc4XYfem 6r9Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706643640; x=1707248440; 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=yzRKimwqPjTIEeKQ1oM17JSZAsqV0NhKJRSyXCx6gfQ=; b=sFFFbF8fr8pAzDzfCEnVeyfbN4I58MmEt938RRLDd987wA6rjL8OjK60gNyWaWBIF0 vLBCD+UQVusNaoh3EzsZAqJdRAU90PkFhkv8H3Dd4Imt3ULDtxUuA2lp9aUYv+yiNZP6 Adac+4QU/LAMoHflvSR6hVjYzzyYiDZtaY9Caq0AZrTdrylJHWfLlKeIY9N8E6tSlglU yTv9KMjGZZHnQoMlCG9dx8O4IXNkNhDmhU+IFZd8fIDpUrd73rsQzeg2juZT5T+5yBhz boljz+nLnS8pE4lHBsFpspasVyuUBMM//pX6/WAak8KBmD+rq1mIcVSHe+jt7xEORouc KEIQ==
X-Gm-Message-State: AOJu0YxvLHYu9NyCRRUZvxb8BU1RrTEwygK0d4pcLFK8CLjacOS76SAU irBH0wnVJXwphrMN5BVdhat3X+nQj2BM3vmZrJERh/E3wv/paKwS08I9yVLeyWIL89/9bjbCVIq I9ABG4GK2DnszqqVuI0gFEo2UEvI=
X-Google-Smtp-Source: AGHT+IEneaXalxZjImehz7khNHBL1BB2s5WCMP9vTzJSctoh6f7iYmbxoTEsifBGVdWIsxaYNuej9dROtc7FE8NC6FQ=
X-Received: by 2002:ac2:5ec8:0:b0:510:40a:4cb2 with SMTP id d8-20020ac25ec8000000b00510040a4cb2mr5988737lfq.38.1706643639703; Tue, 30 Jan 2024 11:40:39 -0800 (PST)
MIME-Version: 1.0
References: <006601da5151$a22b2bb0$e6818310$@gmail.com> <877cjutxe9.fsf@oracle.com> <8734uitx3m.fsf@oracle.com> <01e601da51b7$92c4ffa0$b84efee0$@gmail.com> <CAADnVQK8JegsSxgbQbO=DR71cRgkvN-y9LH_ZQYxmj1a-hCz5g@mail.gmail.com> <071b01da5394$260dba30$72292e90$@gmail.com> <073001da539a$ec1e2b00$c45a8100$@gmail.com>
In-Reply-To: <073001da539a$ec1e2b00$c45a8100$@gmail.com>
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Date: Tue, 30 Jan 2024 11:40:28 -0800
Message-ID: <CAADnVQ+V33Cms=x6HHTCbpKN386NGNa5Z8KeiTujvrefqZod_A@mail.gmail.com>
To: Dave Thaler <dthaler1968@googlemail.com>
Cc: bpf@ietf.org, bpf <bpf@vger.kernel.org>, "Jose E. Marchesi" <jose.marchesi@oracle.com>, Yonghong Song <yonghong.song@linux.dev>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/bpf/5LnnKm093cGpOmDI9TnLQLBXyys>
Subject: Re: [Bpf] ISA: BPF_MSH and deprecated packet access instructions
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: Tue, 30 Jan 2024 19:40:42 -0000
On Tue, Jan 30, 2024 at 8:39 AM <dthaler1968@googlemail.com> wrote: > > > Alexei Starovoitov <alexei.starovoitov@gmail.com> wrote: > > [...] > > > > Although the Linux verifier doesn't support them, the fact that gcc > > > > does support them tells me that it's probably safest to list the DW > > > > and LDX variants as deprecated as well, which is what the draft > > > > already did in the appendix so that's good (nothing to change there, > > > > I think). > > > > > > DW never existed in classic bpf, so abs/ind never had DW flavor. > > > If some assembler/compiler decided to "support" them it's on them. > > > The standard must not list such things as deprecated. They never > > > existed. So nothing is deprecated. > > > > Ack, I will remove the ABS/IND + DW lines from the appendix. > > > > > Same with MSH. BPF_LDX | BPF_MSH | BPF_B is the only insn ever existed. > > > It's a legacy insn. Just like abs/ind. > > > > Should it be listed in the legacy conformance group then? > > > > Currently it's not mentioned in instruction-set.rst at all, so the opcode is > > available to use by any new instruction. If we do list it in instruction-set.rst > > then, like abs/ind, it will be avoided by anyone proposing new instructions. > > Here's my understanding of this thread so far: > > * (IND/ABS) | (W/H/B) | LD : these are accepted by the Linux verifier and are supported > by clang and gcc. They should be in the legacy conformance group of deprecated > instructions. yes > * (IND/ABS) | DW | (LD/LDX) : these are not accepted by the Linux verifier and were > never used. Clang doesn't generate them but gcc did which is now removed > based on this discussion. They should NOT be in the legacy conformance group of > deprecated instructions because they were never defined in the first place, and > instruction-set.rst should be updated to clarify this. yes > * (IND/ABS) | (W/H/B) | LDX : these are not accepted by the Linux verifier and were > never used. Clang doesn't generate them but gcc does. They should NOT > be in the legacy conformance group of deprecated instructions because they were > never defined in the first place, and instruction-set.rst should be updated to clarify this. yes. > * (IND/ABS) | (W/H/B/DW) | (ST/STX): these are not accepted by the Linux verifier and were > never used. I don't know whether clang or gcc generates them. They should NOT > be in the legacy conformance group of deprecated instructions because they were > never defined in the first place, and instruction-set.rst should be updated to clarify this. yes > * MSH | B | LDX: this existed in classic BPF but does not exist in (e)BPF since it is not accepted > by the Linux verifier. I don't know whether clang ever generated them, but gcc never did. > The "Legacy BPF Packet access instructions" section of instruction-set.rst says > > BPF previously introduced special instructions for access to packet data that were carried > > over from classic BPF. However, these instructions are deprecated and should no longer be used. > I read Alexei's comment "It's a legacy insn. Just like abs/ind" as a possible argument that MSH|B|LDX > should be mentioned in instruction-set.rst, pointing to the above section, like IND/ABS do. > But Yonghong argued that it was never accepted by the verifier, so need not be mentioned. Yonghong is actually more correct here. MSH | B | LDX is only accepted by _classic_ BPF. It was never accepted by eBPF verifier, so I have to back track my earlier suggestion. I think it's undefined opcode from 'eBPF standardization' pov. The standard doesn't talk about 'classic BPF' at all. So it's fine to use MSH | B | LDX for something in the future. > * MSH | (W/H/DW) | (LD/ST/STX): These are not accepted by the Linux verifier and were > never used. They should NOT be in the legacy conformance group of deprecated instructions > because they were never defined in the first place. yes.
- [Bpf] ISA: BPF_MSH and deprecated packet access i… dthaler1968
- Re: [Bpf] ISA: BPF_MSH and deprecated packet acce… Jose E. Marchesi
- Re: [Bpf] ISA: BPF_MSH and deprecated packet acce… Jose E. Marchesi
- Re: [Bpf] ISA: BPF_MSH and deprecated packet acce… dthaler1968
- Re: [Bpf] ISA: BPF_MSH and deprecated packet acce… Yonghong Song
- Re: [Bpf] ISA: BPF_MSH and deprecated packet acce… dthaler1968
- Re: [Bpf] ISA: BPF_MSH and deprecated packet acce… Yonghong Song
- Re: [Bpf] ISA: BPF_MSH and deprecated packet acce… Alexei Starovoitov
- Re: [Bpf] ISA: BPF_MSH and deprecated packet acce… Jose E. Marchesi
- Re: [Bpf] ISA: BPF_MSH and deprecated packet acce… Jose E. Marchesi
- Re: [Bpf] ISA: BPF_MSH and deprecated packet acce… dthaler1968
- Re: [Bpf] ISA: BPF_MSH and deprecated packet acce… Alexei Starovoitov
- Re: [Bpf] ISA: BPF_MSH and deprecated packet acce… dthaler1968
- Re: [Bpf] ISA: BPF_MSH and deprecated packet acce… dthaler1968
- Re: [Bpf] ISA: BPF_MSH and deprecated packet acce… Yonghong Song
- Re: [Bpf] ISA: BPF_MSH and deprecated packet acce… Alexei Starovoitov