Re: [PATCH bpf-next 5/5] tools/bpftool: add support for in-kernel and named BTF in `btf show`

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 9, 2020 at 8:43 AM Alan Maguire <alan.maguire@xxxxxxxxxx> wrote:
>
> On Thu, 5 Nov 2020, Andrii Nakryiko wrote:
>
> > Display vmlinux BTF name and kernel module names when listing available BTFs
> > on the system.
> >
> > In human-readable output mode, module BTFs are reported with "name
> > [module-name]", while vmlinux BTF will be reported as "name [vmlinux]".
> > Square brackets are added by bpftool and follow kernel convention when
> > displaying modules in human-readable text outputs.
> >
>
> I had a go at testing this and all looks good, but I was curious
> if  "bpftool btf dump" is expected to work with module BTF? I see
> the various modules in /sys/kernel/btf, but if I run:
>
> # bpftool btf dump file /sys/kernel/btf/ixgbe

You need to specify vmlinux as a base BTF. There is a -B flag for
that, added in [0]. So just add -B /sys/kernel/btf/vmlinux. I think we
might want to teach bpftool to do this automatically if we see that
file points at module BTF in /sys/kernel/btf, as a convenience
feature.

  [0] https://patchwork.kernel.org/project/netdevbpf/patch/20201105043402.2530976-12-andrii@xxxxxxxxxx/


> Error: failed to load BTF from /sys/kernel/btf/ixgbe: Invalid argument
>
> ...while it still works for vmlinux:
>
> # bpftool btf dump file /sys/kernel/btf/vmlinux
> [1] INT '(anon)' size=4 bits_offset=0 nr_bits=32 encoding=(none)
> [2] INT 'long unsigned int' size=8 bits_offset=0 nr_bits=64
> encoding=(none)
> ...
>
> "bpftool btf show" works for ixgbe:
>
> # bpftool btf show|grep ixgbe
> 19: name [ixgbe]  size 182074B
>
> Is this perhaps not expected to work yet? (I updated pahole
> to the latest changes etc and BTF generation seemed to work
> fine for modules during kernel build).
>
> For the "bpftool btf show" functionality, feel free to add
>
> Tested-by: Alan Maguire <alan.maguire@xxxxxxxxxx>

Ok, thanks.

>
> Thanks!
>
> Alan



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux