From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Ilya Leoshkevich <iii@linux.ibm.com>,
Jiri Olsa <jolsa@kernel.org>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
dwarves@vger.kernel.org, bpf <bpf@vger.kernel.org>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>, Yonghong Song <yhs@fb.com>,
Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>
Subject: Re: [PATCH] btf: Add support for the floating-point types
Date: Sun, 7 Mar 2021 11:09:16 -0300 [thread overview]
Message-ID: <YETejOpEPkaP3UU1@kernel.org> (raw)
In-Reply-To: <YETaG9CZbrzMNmbh@kernel.org>
Adding Jiri to the CC list.
Em Sun, Mar 07, 2021 at 10:50:19AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Sun, Mar 07, 2021 at 10:44:21AM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Sun, Mar 07, 2021 at 10:16:31AM -0300, Arnaldo Carvalho de Melo escreveu:
> > > Em Sat, Mar 06, 2021 at 07:16:08PM -0800, Andrii Nakryiko escreveu:
> > > > On Fri, Mar 5, 2021 at 6:22 PM Ilya Leoshkevich <iii@linux.ibm.com> wrote:
> > > > >
> > > > > Some BPF programs compiled on s390 fail to load, because s390
> > > > > arch-specific linux headers contain float and double types.
> > > > >
> > > > > Fix as follows:
> > > > >
> > > > > - Make DWARF loader fill base_type.float_type.
> > > > >
> > > > > - libbpf introduced support for the floating-point types in commit
> > > > > 986962fade5, so update the libbpf submodule to that version and use
> > > > > the new btf__add_float() function in order to emit the floating-point
> > > > > types when base_type.float_type is set.
> > > > >
> > > > > Example of the resulting entry in the vmlinux BTF:
> > > > >
> > > > > [7164] FLOAT 'double' size=8
> >
> > > > [PATCH dwarves] would make it a bit clearer that this is pahole patch.
> >
> > > > But LGTM.
> >
> > > So older versions of bpftool will fail with a .BTF section having this
> > > new float? I thought it would just skip it emitting a warning? Probably
> > > not possible as we don't have the record size encoded in a header,
> > > right?
> >
> > > [acme@five pahole]$ bpftool btf dump file vmlinux | grep -w FLOAT
> > > [acme@five pahole]$ type pahole
> > > pahole is /home/acme/bin/pahole
> > > [acme@five pahole]$ ls -la ~/bin/pahole
> > > lrwxrwxrwx. 1 acme acme 34 Jan 29 11:00 /home/acme/bin/pahole -> /home/acme/git/pahole/build/pahole
> > > [acme@five pahole]$ pahole -J vmlinux
> > > [acme@five pahole]$ bpftool btf dump file vmlinux | grep -w FLOAT | head
> > > Error: failed to load BTF from vmlinux: Invalid argument
> > > [acme@five pahole]$
> > >
> > > Perhaps the warning emitted by bpftool should suggest updating the tool
> > > as it found a record type it doesn't know about?
> > >
> > > /me goes to update bpftool...
> >
> > Works with the bpftool in bpf-next:
> >
> > [acme@five pahole]$ bpftool btf dump file vmlinux | grep -w FLOAT | head
> > [8006] FLOAT 'double' size=8
> > [acme@five pahole]$
>
> Applied, with this committer notes:
>
> Committer testing:
>
> $ rm -rf build # To update the libbpf git submodule
> $ mkdir build
> $ cd build
> $ cmake ..
> $ cd ..
> $ make -C build
> # No BTF_KIND_FLOAT before:
> $ bpftool btf dump file vmlinux | grep -w FLOAT
> $ type pahole
> pahole is /home/acme/bin/pahole
> $ ls -la ~/bin/pahole
> lrwxrwxrwx. 1 acme acme 34 Jan 29 11:00 /home/acme/bin/pahole -> /home/acme/git/pahole/build/pahole
> # Encode BTF:
> $ pahole -J vmlinux
> $ bpftool btf dump file vmlinux | grep -w FLOAT | head
> Error: failed to load BTF from vmlinux: Invalid argument
> $
> # Update bpftool to what is in bpf-next, then try again:
> $ bpftool btf dump file vmlinux | grep -w FLOAT
> [8006] FLOAT 'double' size=8
> $
> # Now check that pahole works well, i.e. that the BTF loader works
> $ pahole -F btf vmlinux -C sk_buff_head
> struct sk_buff_head {
> struct sk_buff * next; /* 0 8 */
> struct sk_buff * prev; /* 8 8 */
> __u32 qlen; /* 16 4 */
> spinlock_t lock; /* 20 4 */
>
> /* size: 24, cachelines: 1, members: 4 */
> /* last cacheline: 24 bytes */
> };
> $
> $ pahole -F btf vmlinux | wc -l
> 122676
> $
>
> Now will build a kernel with this new version, reboot, then push
> publicly.
So now trying to build v5.12-rc2 with pahole supporting BTF_KIND_FLOAT:
AS .tmp_vmlinux.kallsyms2.S
LD vmlinux
BTFIDS vmlinux
FAILED: load BTF from vmlinux: Invalid argument
make[1]: *** [/home/acme/git/linux/Makefile:1197: vmlinux] Error 255
make[1]: Leaving directory '/home/acme/git/build/v5.12.0-rc2'
make: *** [Makefile:215: __sub-make] Error 2
[acme@five linux]$
[acme@five linux]$ egrep BTF\|DWARF ../build/v5.12.0-rc2/.config
CONFIG_VIDEO_SONY_BTF_MPX=m
CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
# CONFIG_DEBUG_INFO_DWARF4 is not set
CONFIG_DEBUG_INFO_BTF=y
CONFIG_PAHOLE_HAS_SPLIT_BTF=y
CONFIG_DEBUG_INFO_BTF_MODULES=y
[acme@five linux]$
Ideas?
- Arnaldo
next prev parent reply other threads:[~2021-03-07 14:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-06 2:22 [PATCH] btf: Add support for the floating-point types Ilya Leoshkevich
2021-03-07 3:16 ` Andrii Nakryiko
2021-03-07 13:16 ` Arnaldo Carvalho de Melo
2021-03-07 13:44 ` Arnaldo Carvalho de Melo
2021-03-07 13:50 ` Arnaldo Carvalho de Melo
2021-03-07 14:09 ` Arnaldo Carvalho de Melo [this message]
2021-03-08 3:02 ` Ilya Leoshkevich
[not found] ` <YEYgVmo0ryuM3SUY@kernel.org>
2021-03-08 22:16 ` Andrii Nakryiko
2021-03-08 22:31 ` Ilya Leoshkevich
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=YETejOpEPkaP3UU1@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=andrii.nakryiko@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=dwarves@vger.kernel.org \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=iii@linux.ibm.com \
--cc=jolsa@kernel.org \
--cc=yhs@fb.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.