BPF List
 help / color / mirror / Atom feed
From: David Vernet <void@manifault.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Dave Thaler <dthaler=40microsoft.com@dmarc.ietf.org>,
	Dave Thaler <dthaler1968=40googlemail.com@dmarc.ietf.org>,
	"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
	"bpf@ietf.org" <bpf@ietf.org>
Subject: Re: [Bpf] [PATCH bpf-next v2] bpf, docs: Explain helper functions
Date: Wed, 8 Feb 2023 11:40:14 -0600	[thread overview]
Message-ID: <Y+PefizA09h21XSF@maniforge.lan> (raw)
In-Reply-To: <CAADnVQ+hgqw4fL8Vvq7GkP8VkO3wvFbhVD-LFU+h9-8vQC+0RQ@mail.gmail.com>

On Wed, Feb 08, 2023 at 09:31:18AM -0800, Alexei Starovoitov wrote:
> On Wed, Feb 8, 2023 at 9:26 AM Dave Thaler
> <dthaler=40microsoft.com@dmarc.ietf.org> wrote:
> >
> > David Vernet wrote:
> > > > +Reserved instructions
> > > > +====================
> > >
> > > small nit: Missing a =
> >
> > Ack.
> >
> > > > +Clang will generate the reserved ``BPF_CALL | BPF_X | BPF_JMP`` (0x8d)
> > > instruction if ``-O0`` is used.
> > >
> > > Are we calling this out here to say that BPF_CALL in clang -O0 builds is not
> > > supported? That would seem to be the case given that we say that BPF_CALL
> > > | BPF_X | BPF_JMP in reserved and not permitted in instruction-set.rst.
> >
> > Yes, exactly.  I could update the language to add something like
> > "... so BPF_CALL in clang -O0 builds is not supported".
> 
> That will not be a correct statement.
> BPF_CALL is a valid insn regardless of optimization flags.
> BPF_CALLX will be a valid insn when the verifier support is added.
> Compilers need to make a choice which insn to use on a case by case basis.
> When compilers have no choice, but to use call by register they will
> use callx. That what happens with = (void *)1 hack that we use for
> helpers.
> It can happen with -O2 just as well.

In that case, I suggest we update the verbiage in instruction-set.rst to
say:

Note that ``BPF_CALL | BPF_X | BPF_JMP`` (0x8d), where the helper
function integer would be read from a specified register, is not
currently supported by the verifier. Any programs with this instruction
will fail to load until such support is added.

And then we can update this section to say something similar, or just
remove it altogether per Alexei's point that it's an implementation
detail of the compiler which could change at any time.

  reply	other threads:[~2023-02-08 17:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-06 19:16 [PATCH bpf-next v2] bpf, docs: Explain helper functions Dave Thaler
2023-02-08 15:10 ` [Bpf] " David Vernet
2023-02-08 17:26   ` Dave Thaler
2023-02-08 17:29     ` David Vernet
2023-02-08 17:31     ` Alexei Starovoitov
2023-02-08 17:40       ` David Vernet [this message]
2023-02-08 17:45         ` Dave Thaler
2023-02-09 16:04           ` David Vernet
2023-02-12 23:20 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y+PefizA09h21XSF@maniforge.lan \
    --to=void@manifault.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=bpf@ietf.org \
    --cc=bpf@vger.kernel.org \
    --cc=dthaler1968=40googlemail.com@dmarc.ietf.org \
    --cc=dthaler=40microsoft.com@dmarc.ietf.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox