[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzZPYAZ-ZJXa0CnrpxzFrXjTScfuioF=DOAw4j1L_tMXTg@mail.gmail.com>
Date: Thu, 25 Aug 2022 13:26:45 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: "chentao.ct" <chentao.kernel@...ux.alibaba.com>
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.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>, netdev@...r.kernel.org,
bpf@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] libbpf: Support raw btf placed in the default path
On Wed, Aug 24, 2022 at 7:05 AM chentao.ct
<chentao.kernel@...ux.alibaba.com> wrote:
>
> Now only elf btf can be placed in the default path, raw btf should
> also can be there.
>
It's not clear what you are trying to achieve. Do you want libbpf to
attempt to load /boot/vmlinux-%1$s as raw BTF as well (so you can sort
of sneak in pregenerated BTF), or what exactly?
btf__load_vmlinux_btf() code already supports loading raw BTF, it just
needs to be explicitly specified in locations table.
So with your change locations[i].raw_btf check doesn't make sense and
we need to clean this up.
But first, let's discuss the use case, instead of your specific solution.
> Signed-off-by: chentao.ct <chentao.kernel@...ux.alibaba.com>
> ---
> tools/lib/bpf/btf.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
> index bb1e06e..b22b5b3 100644
> --- a/tools/lib/bpf/btf.c
> +++ b/tools/lib/bpf/btf.c
> @@ -4661,7 +4661,7 @@ struct btf *btf__load_vmlinux_btf(void)
> } locations[] = {
> /* try canonical vmlinux BTF through sysfs first */
> { "/sys/kernel/btf/vmlinux", true /* raw BTF */ },
> - /* fall back to trying to find vmlinux ELF on disk otherwise */
> + /* fall back to trying to find vmlinux RAW/ELF on disk otherwise */
> { "/boot/vmlinux-%1$s" },
> { "/lib/modules/%1$s/vmlinux-%1$s" },
> { "/lib/modules/%1$s/build/vmlinux" },
> @@ -4686,7 +4686,7 @@ struct btf *btf__load_vmlinux_btf(void)
> if (locations[i].raw_btf)
> btf = btf__parse_raw(path);
> else
> - btf = btf__parse_elf(path, NULL);
> + btf = btf__parse(path, NULL);
> err = libbpf_get_error(btf);
> pr_debug("loading kernel BTF '%s': %d\n", path, err);
> if (err)
> --
> 2.2.1
>
Powered by blists - more mailing lists