[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAEf4BzZ=_C6pOjoLKpbZaWB0=28YhbPvU3f9sS5P1W3Lc_NQHQ@mail.gmail.com>
Date: Mon, 9 May 2022 17:24:33 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Larysa Zaremba <larysa.zaremba@...el.com>
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>,
Quentin Monnet <quentin@...valent.com>,
Maciej Fijalkowski <maciej.fijalkowski@...el.com>,
Alexander Lobakin <alexandr.lobakin@...el.com>
Subject: Re: [PATCH bpf-next v2] bpftool: Use sysfs vmlinux when dumping BTF
by ID
On Thu, May 5, 2022 at 6:17 AM Larysa Zaremba <larysa.zaremba@...el.com> wrote:
>
> Currently, dumping almost all BTFs specified by id requires
> using the -B option to pass the base BTF. For kernel module
> BTFs the vmlinux BTF sysfs path should work.
>
> This patch simplifies dumping by ID usage by attempting to
> use vmlinux BTF from sysfs, if the first try of loading BTF by ID
> fails with certain conditions and the ID corresponds to a kernel
> module BTF.
It feels sloppy to first try without base BTF and then fallback to
base BTF. When specified ID of BTF object, let's just get its struct
bpf_btf_info with bpf_obj_get_info_by_fd() and then check that
kernel_btf is set and name isn't "vmlinux". This will mean it's kernel
module, so load base BTF from /sys/kernel/btf/vmlinux. If that fails,
there is no way that kernel module BTF will be successfully loaded, so
there is no point in trying.
>
> Signed-off-by: Larysa Zaremba <larysa.zaremba@...el.com>
> Reviewed-by: Alexander Lobakin <alexandr.lobakin@...el.com>
> ---
> tools/bpf/bpftool/btf.c | 67 +++++++++++++++++++++++++++++++++++------
> 1 file changed, 58 insertions(+), 9 deletions(-)
>
[...]
Powered by blists - more mailing lists