public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: David Faust <david.faust@oracle.com>
To: Nick Clifton <nickc@redhat.com>, binutils@sourceware.org
Subject: Re: [PATCH] bpf: use the expected instruction for NOPs
Date: Tue, 15 Sep 2020 09:18:05 -0700	[thread overview]
Message-ID: <020b537c-75ac-95d5-e38c-5d57e50202c7@oracle.com> (raw)
In-Reply-To: <9ac97514-af3d-f343-35c6-308f4dde57f1@redhat.com>

Hi Nick!

>> The BPF ISA does not have a no-op instruction.
> 
> Just an aside - wouldn't it be a good idea if the ISA did define an explicit
> encoding for no-ops ?

In my opinion, yes that would be good. But, eBPF is effectively defined
by its implementation in the kernel, so we have to support whatever the
kernel decides for the ISA.

> 
>> There are different ways
>> to achieve no-op, but in practice the Linux kernel verifier expects a
>> particular form, namely "ja 0". Update the define md_single_noop_insn
>> for BPF to reflect this.
> 
> Thanks for pointing this out.  I took the original encoding from the
> gas/testsuite/gas/all/org-1.s file, in the hopes that it would be correct
> one.
>  

I wasn't actually aware of this until yesterday. It was your patch
adding the .nop directive that prompted digging into precisely what the
kernel expects for no-op; thank you.

(The kernel eBPF verifier has an optimization built into it to remove
no-ops, and it defines no-op as 'ja 0'.)

>> gas/
>> 	* config/tc-bpf.h (md_single_noop_insn): Use 'ja 0' for no-op.
> 
> Approved and applied.
> 
> Cheers
>   Nick
> 

Thanks!

David

      reply	other threads:[~2020-09-15 16:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-14 19:48 David Faust
2020-09-15  9:37 ` Nick Clifton
2020-09-15 16:18   ` David Faust [this message]

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=020b537c-75ac-95d5-e38c-5d57e50202c7@oracle.com \
    --to=david.faust@oracle.com \
    --cc=binutils@sourceware.org \
    --cc=nickc@redhat.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).