Re: [Bpf] Review of draft-thaler-bpf-isa-01

Will Hawkins <hawkinsw@obs.cr> Wed, 26 July 2023 19:16 UTC

Return-Path: <hawkinsw@obs.cr>
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 CB20AC15C520 for <bpf@ietfa.amsl.com>; Wed, 26 Jul 2023 12:16:24 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.905
X-Spam-Level:
X-Spam-Status: No, score=-6.905 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=obs-cr.20221208.gappssmtp.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 kPYUQ9JBhPxJ for <bpf@ietfa.amsl.com>; Wed, 26 Jul 2023 12:16:20 -0700 (PDT)
Received: from mail-vs1-xe29.google.com (mail-vs1-xe29.google.com [IPv6:2607:f8b0:4864:20::e29]) (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 6F575C15C501 for <bpf@ietf.org>; Wed, 26 Jul 2023 12:16:20 -0700 (PDT)
Received: by mail-vs1-xe29.google.com with SMTP id ada2fe7eead31-4452fe640fbso59500137.0 for <bpf@ietf.org>; Wed, 26 Jul 2023 12:16:20 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=obs-cr.20221208.gappssmtp.com; s=20221208; t=1690398979; x=1691003779; 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=JM0ukKexePxMNw1wW/WLU+P2Zc71N+iGNBjfGQCeoCk=; b=Bt4VN8O53f0KG+ZxAAB+hWBFMVXZi01E0yyoSRd2/SdgshfnugBS+zAjbbJb0jmMvc x62uJrnWRaZRgArfLTjSGX6xbOApAupL9UMIOmREW9tq4WuEL/oTm83ruLYnySW771m0 NzM4QKDWGw5b+VVrsQcbSG0JWisv9SjjuvKxrGkPEz4cElxEXHy21h0SrW0BMRNcvi7I +IArYh0iJfkmLdrQSz5/DE/qdTztllbp5nYvhc5dDslHoi/s4Pa9kD0Ca4YKf/2gpWFo OwXBu6k2VbiUIdrt8BrovNc+1txeHGrsUW0o8Z6FHYWpkNvtI2c4jqNkLIN1WIqdyIJu se1g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690398979; x=1691003779; 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=JM0ukKexePxMNw1wW/WLU+P2Zc71N+iGNBjfGQCeoCk=; b=k/TwIDClPChaUQorXIIdz4VH8aoGxzfEjm7vVTFnxwa6FVTwpHT8+4QpNwie83s6dq g7NXy8RHxI+WkRlpl/CQjHKqV4TficwFgOCLF9SyNPICNS4Fvn1QDUuZM3tHnOAghD4t tTfA1Wx6W7v0vya6OXnWJOAWCPKQg5WD0iuPpLXXN+KlZ04C7AcaGR4R/LHP9rjNg8Ll uDBYT7w1PV5Ho5LGbiDY+tgqjL47TYPa21CdyDs8TvdTTMdR3lWTbD5afqu4Galj6F76 NO2lw8HXD/z02ireDYCpxjKJcQg6ghmzO8TeEx9OLtqXz63T70HE7YaXuIX1/H3gndE1 VBcg==
X-Gm-Message-State: ABy/qLaOhmakpq3QBFMyKNo2rsRN8QtvUzXVC2nkNqutNLAfO5rEaW1f 7GxbOLI48oqgk12JvlG5b12Hd91UFrGMCAe4ppJqqQ==
X-Google-Smtp-Source: APBJJlH038bb259dvNC1s2Kh0EZ2ksB/8UiE4ZmHMtZECcEAgle/dnoZe3klf/zzDDbN/4k4M1Lqx5jGP2l5HcooXg0=
X-Received: by 2002:a05:6102:84:b0:440:cbbf:cd72 with SMTP id t4-20020a056102008400b00440cbbfcd72mr69039vsp.4.1690398979395; Wed, 26 Jul 2023 12:16:19 -0700 (PDT)
MIME-Version: 1.0
References: <CACsn0ckZO+b5bRgMZhOvx+Jn-sa0g8cBD+ug1CJEdtYxSm_hgA@mail.gmail.com> <PH7PR21MB3878D8DCEF24A5F8E52BA59DA303A@PH7PR21MB3878.namprd21.prod.outlook.com> <CAADnVQJ1fKXcsTXdCijwQzf0OVF0md-ATN5RbB3g10geyofNzA@mail.gmail.com> <CACsn0cmf22zEN9AduiRiFnQ7XhY1ABRL=SwAwmmFgxJvVZAOsg@mail.gmail.com>
In-Reply-To: <CACsn0cmf22zEN9AduiRiFnQ7XhY1ABRL=SwAwmmFgxJvVZAOsg@mail.gmail.com>
From: Will Hawkins <hawkinsw@obs.cr>
Date: Wed, 26 Jul 2023 15:16:08 -0400
Message-ID: <CADx9qWi+VQ=do+_Bsd8W4Yc-S1LekVq7Hp4bfD3nz0YP47Sqgg@mail.gmail.com>
To: Watson Ladd <watsonbladd@gmail.com>
Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>, Dave Thaler <dthaler@microsoft.com>, "bpf@ietf.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/o5cRBOEjodUaQAGILKrEWDRTh30>
Subject: Re: [Bpf] Review of draft-thaler-bpf-isa-01
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: Wed, 26 Jul 2023 19:16:24 -0000

On Tue, Jul 25, 2023 at 2:37 PM Watson Ladd <watsonbladd@gmail.com> wrote:
>
> On Tue, Jul 25, 2023 at 9:15 AM Alexei Starovoitov
> <alexei.starovoitov@gmail.com> wrote:
> >
> > On Tue, Jul 25, 2023 at 7:03 AM Dave Thaler <dthaler@microsoft.com> wrote:
> > >
> > > I am forwarding the email below (after converting HTML to plain text)
> > > to the mailto:bpf@vger.kernel.org list so replies can go to both lists.
> > >
> > > Please use this one for any replies.
> > >
> > > Thanks,
> > > Dave
> > >
> > > > From: Bpf <bpf-bounces@ietf.org> On Behalf Of Watson Ladd
> > > > Sent: Monday, July 24, 2023 10:05 PM
> > > > To: bpf@ietf.org
> > > > Subject: [Bpf] Review of draft-thaler-bpf-isa-01
> > > >
> > > > Dear BPF wg,
> > > >
> > > > I took a look at the draft and think it has some issues, unsurprisingly at this stage. One is
> > > > the specification seems to use an underspecified C pseudo code for operations vs
> > > > defining them mathematically.
> >
> > Hi Watson,
> >
> > This is not "underspecified C" pseudo code.
> > This is assembly syntax parsed and emitted by GCC, LLVM, gas, Linux Kernel, etc.
>
> I don't see a reference to any description of that in section 4.1.
> It's possible I've overlooked this, and if people think this style of
> definition is good enough that works for me. But I found table 4
> pretty scanty on what exactly happens.

Hello! Based on Watson's post, I have done some research and would
potentially like to offer a path forward. There are several different
ways that ISAs specify the semantics of their operations:

1. Intel has a section in their manual that describes the pseudocode
they use to specify their ISA: Section 3.1.1.9 of The Intel® 64 and
IA-32 Architectures Software Developer’s Manual at
https://cdrdv2.intel.com/v1/dl/getContent/671199
2. ARM has an equivalent for their variety of pseudocode: Chapter J1
of Arm Architecture Reference Manual for A-profile architecture at
https://developer.arm.com/documentation/ddi0487/latest/
3. Sail "is a language for describing the instruction-set architecture
(ISA) semantics of processors."
(https://www.cl.cam.ac.uk/~pes20/sail/)

Given the commercial nature of (1) and (2), perhaps Sail is a way to
proceed. If people are interested, I would be happy to lead an effort
to encode the eBPF ISA semantics in Sail (or find someone who already
has) and incorporate them in the draft.

Sincerely,
Will

> >
> > > > The good news is I think this is very fixable although tedious.
> > > >
> > > > The other thornier issues are memory model etc. But the overall structure seems good
> > > > and the document overall makes sense.
> >
> > What do you mean by "memory model" ?
> > Do you see a reference to it ? Please be specific.
>
> No, and that's the problem. Section 5.2 talks about atomic operations.
> I'd expect that to be paired with a description of barriers so that
> these work, or a big warning about when you need to use them. For
> clarity I'm pretty unfamiliar with bpf as a technology, and it's
> possible that with more knowledge this would make sense. On looking
> back on that I don't even know if the memory space is flat, or
> segmented: can I access maps through a value set to dst+offset, or
> must I always used index? I'm just very confused.
>
> Sincerely,
> Watson
>
> --
> Astra mortemque praestare gradatim
>
> --
> Bpf mailing list
> Bpf@ietf.org
> https://www.ietf.org/mailman/listinfo/bpf