From: Shreesh Adiga <16567adigashreesh@gmail.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: qemu-devel@nongnu.org, jasowang@redhat.com, andrew@daynix.com,
yuri.benditovich@daynix.com, "Thomas Huth" <thuth@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Mauro Matteo Cascella" <mcascell@redhat.com>
Subject: Re: [PATCH] ebpf: fix compatibility with libbpf 1.0+
Date: Tue, 20 Dec 2022 22:00:50 +0530 [thread overview]
Message-ID: <Y6HjOqjECShxPfzU@arch.localdomain> (raw)
In-Reply-To: <d7f05d4f-2a56-6663-4a66-e53c3f14a061@linaro.org>
On Sun, Dec 18, 2022 at 05:15:04PM +0100, Philippe Mathieu-Daudé wrote:
> Hi,
>
> On 18/12/22 15:39, Shreesh Adiga wrote:
> > The current implementation fails to load on a system with
> > libbpf 1.0 and reports that legacy map definitions in 'maps'
> > section are not supported by libbpf v1.0+. This commit updates
> > the Makefile to add BTF (-g flag) and appropriately updates
> > the maps in rss.bpf.c and update the skeleton file in repo.
> >
> > Signed-off-by: Shreesh Adiga <16567adigashreesh@gmail.com>
> > ---
> > ebpf/rss.bpf.skeleton.h | 1171 ++++++++++++++++++++++++++++----------
> > tools/ebpf/Makefile.ebpf | 8 +-
> > tools/ebpf/rss.bpf.c | 43 +-
> > 3 files changed, 891 insertions(+), 331 deletions(-)
>
>
> > +static inline const void *rss_bpf__elf_bytes(size_t *sz)
> > +{
> > + *sz = 20440;
> > + return (const void *)"\
> > \x7f\x45\x4c\x46\x02\x01\x01\0\0\0\0\0\0\0\0\0\x01\0\xf7\0\x01\0\0\0\0\0\0\0\0\
> > -\0\0\0\0\0\0\0\0\0\0\0\x18\x1d\0\0\0\0\0\0\0\0\0\0\x40\0\0\0\0\0\x40\0\x0a\0\
> > -\x01\0\xbf\x18\0\0\0\0\0\0\xb7\x01\0\0\0\0\0\0\x63\x1a\x4c\xff\0\0\0\0\xbf\xa7\
> > -\0\0\0\0\0\0\x07\x07\0\0\x4c\xff\xff\xff\x18\x01\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
> > +\0\0\0\0\0\0\0\0\0\0\0\x98\x4c\0\0\0\0\0\0\0\0\0\0\x40\0\0\0\0\0\x40\0\x0d\0\
> > +\x01\0\xbf\x19\0\0\0\0\0\0\xb7\x01\0\0\0\0\0\0\x63\x1a\x54\xff\0\0\0\0\xbf\xa7\
> > +\0\0\0\0\0\0\x07\x07\0\0\x54\xff\xff\xff\x18\x01\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
> > \xbf\x72\0\0\0\0\0\0\x85\0\0\0\x01\0\0\0\xbf\x06\0\0\0\0\0\0\x18\x01\0\0\0\0\0\
> > -\0\0\0\0\0\0\0\0\0\xbf\x72\0\0\0\0\0\0\x85\0\0\0\x01\0\0\0\xbf\x07\0\0\0\0\0\0\
> > -\x18\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0\x15\x06\x66\x02\0\0\0\0\xbf\x79\0\0\
> > -\0\0\0\0\x15\x09\x64\x02\0\0\0\0\x71\x61\0\0\0\0\0\0\x55\x01\x01\0\0\0\0\0\x05\
> > -\0\x5d\x02\0\0\0\0\xb7\x01\0\0\0\0\0\0\x63\x1a\xc0\xff\0\0\0\0\x7b\x1a\xb8\xff\
> > -\0\0\0\0\x7b\x1a\xb0\xff\0\0\0\0\x7b\x1a\xa8\xff\0\0\0\0\x7b\x1a\xa0\xff\0\0\0\
> > -\0\x63\x1a\x98\xff\0\0\0\0\x7b\x1a\x90\xff\0\0\0\0\x7b\x1a\x88\xff\0\0\0\0\x7b\
> > -\x1a\x80\xff\0\0\0\0\x7b\x1a\x78\xff\0\0\0\0\x7b\x1a\x70\xff\0\0\0\0\x7b\x1a\
> > -\x68\xff\0\0\0\0\x7b\x1a\x60\xff\0\0\0\0\x7b\x1a\x58\xff\0\0\0\0\x7b\x1a\x50\
> > -\xff\0\0\0\0\x15\x08\x4c\x02\0\0\0\0\x6b\x1a\xd0\xff\0\0\0\0\xbf\xa3\0\0\0\0\0\
> > -\0\x07\x03\0\0\xd0\xff\xff\xff\xbf\x81\0\0\0\0\0\0\xb7\x02\0\0\x0c\0\0\0\xb7\
> > +\0\0\0\0\0\0\0\0\0\xbf\x72\0\0\0\0\0\0\x85\0\0\0\x01\0\0\0\xbf\x08\0\0\0\0\0\0\
> > +\x18\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0\x15\x06\x67\x02\0\0\0\0\xbf\x87\0\0\
> > +\0\0\0\0\x15\x07\x65\x02\0\0\0\0\x71\x61\0\0\0\0\0\0\x55\x01\x01\0\0\0\0\0\x05\
> > +\0\x5e\x02\0\0\0\0\xb7\x01\0\0\0\0\0\0\x63\x1a\xc8\xff\0\0\0\0\x7b\x1a\xc0\xff\
> > +\0\0\0\0\x7b\x1a\xb8\xff\0\0\0\0\x7b\x1a\xb0\xff\0\0\0\0\x7b\x1a\xa8\xff\0\0\0\
> > +\0\x63\x1a\xa0\xff\0\0\0\0\x7b\x1a\x98\xff\0\0\0\0\x7b\x1a\x90\xff\0\0\0\0\x7b\
> > +\x1a\x88\xff\0\0\0\0\x7b\x1a\x80\xff\0\0\0\0\x7b\x1a\x78\xff\0\0\0\0\x7b\x1a\
> > +\x70\xff\0\0\0\0\x7b\x1a\x68\xff\0\0\0\0\x7b\x1a\x60\xff\0\0\0\0\x7b\x1a\x58\
> > +\xff\0\0\0\0\x15\x09\x4d\x02\0\0\0\0\x6b\x1a\xd0\xff\0\0\0\0\xbf\xa3\0\0\0\0\0\
> [...]
>
> Can we have a build system step which generates this file and compare
> with what is committed in the repository that we can run in our CI?
>
> That would avoid the need of human review of this blob.
>
Here are the steps to verify:
Pull latest archlinux/archlinux docker image and get a bash shell inside
the container. Install the required toolchain packages.
pacman -Syu --noconfirm
pacman -S --noconfirm bpf libbpf llvm clang make
Confirm the versions:
clang 14.0.6
bpftool 7.0.0
libbpf 1.0.1
After this, ensure that the files Makefile.ebpf and rss.bpf.c from this
patch exist at /home/shreesh/c/qemu/tools/ebpf/ inside the docker.
This path seems to be important since BTF info seems to contain the absolute
path of rss.bpf.c which was compiled by clang and is embedded inside
the generated ELF object.
Run `make -C /home/shreesh/c/qemu/tools/ebpf -f Makefile.ebpf` and
verify that `sha256sum /home/shreesh/c/qemu/tools/ebpf/rss.bpf.skeleton.h` is
a54af3d1fb401ddd56c151f00ae20d6557e965c0a1a4d8ed5f8d925457158a0e which
should be the same as the one submitted as part of this patch.
I'm not familiar with QEMU's CI and am not sure if the above steps can
be converted into build system steps. However it should be doable by a
human and verify that the generated skeleton file is correct and not
tampered with.
Regards,
Shreesh
next prev parent reply other threads:[~2022-12-20 16:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-18 14:39 [PATCH] ebpf: fix compatibility with libbpf 1.0+ Shreesh Adiga
2022-12-18 16:15 ` Philippe Mathieu-Daudé
2022-12-20 16:30 ` Shreesh Adiga [this message]
2022-12-28 16:19 ` Andrew Melnichenko
2023-02-14 20:10 ` Andrew Melnichenko
2023-02-16 5:28 ` Jason Wang
2022-12-19 10:56 ` Daniel P. Berrangé
2022-12-19 13:44 ` Shreesh Adiga
2022-12-19 13:49 ` Daniel P. Berrangé
2022-12-20 14:02 ` Shreesh Adiga
2022-12-20 14:05 ` Daniel P. Berrangé
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=Y6HjOqjECShxPfzU@arch.localdomain \
--to=16567adigashreesh@gmail.com \
--cc=andrew@daynix.com \
--cc=berrange@redhat.com \
--cc=jasowang@redhat.com \
--cc=mcascell@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
--cc=yuri.benditovich@daynix.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 NNTP newsgroup(s).