Re: [PATCH bpf-next v3] bpftool: Add support for custom BTF path in prog load/loadall
From: Jiayuan Chen
Date: Fri May 16 2025 - 10:25:34 EST
May 16, 2025 at 18:18, "Quentin Monnet" <qmo@xxxxxxxxxx> wrote:
>
> 2025-05-16 11:23 UTC+0800 ~ Jiayuan Chen <jiayuan.chen@xxxxxxxxx>
>
> >
> > This patch exposes the btf_custom_path feature to bpftool, allowing users
> >
> > to specify a custom BTF file when loading BPF programs using prog load or
> >
> > prog loadall commands.
> >
> >
> >
> > The argument 'btf_custom_path' in libbpf is used for those kernels that
> >
> > don't have CONFIG_DEBUG_INFO_BTF enabled but still want to perform CO-RE
> >
> > relocations.
> >
> >
> >
> > Suggested-by: Quentin Monnet <qmo@xxxxxxxxxx>
> >
> > Signed-off-by: Jiayuan Chen <jiayuan.chen@xxxxxxxxx>
> >
> >
> >
> > ---
> >
> > V2 -> V3: Optimized document grammar and some prompts
> >
> > https://lore.kernel.org/bpf/20250515065018.240188-1-jiayuan.chen@xxxxxxxxx/
> >
> > V1 -> V2: Added bash completion and documentation
> >
> > https://lore.kernel.org/bpf/20250513035853.75820-1-jiayuan.chen@xxxxxxxxx/
> >
> > ---
> >
> > tools/bpf/bpftool/Documentation/bpftool-prog.rst | 8 +++++++-
> >
> > tools/bpf/bpftool/bash-completion/bpftool | 4 ++--
> >
> > tools/bpf/bpftool/prog.c | 12 +++++++++++-
> >
> > 3 files changed, 20 insertions(+), 4 deletions(-)
> >
> >
> >
> > diff --git a/tools/bpf/bpftool/Documentation/bpftool-prog.rst b/tools/bpf/bpftool/Documentation/bpftool-prog.rst
> >
> > index d6304e01afe0..4dce43e8e8a3 100644
> >
> > --- a/tools/bpf/bpftool/Documentation/bpftool-prog.rst
> >
> > +++ b/tools/bpf/bpftool/Documentation/bpftool-prog.rst
> >
> > @@ -127,7 +127,7 @@ bpftool prog pin *PROG* *FILE*
> >
> > Note: *FILE* must be located in *bpffs* mount. It must not contain a dot
> >
> > character ('.'), which is reserved for future extensions of *bpffs*.
> >
> >
> >
> > -bpftool prog { load | loadall } *OBJ* *PATH* [type *TYPE*] [map { idx *IDX* | name *NAME* } *MAP*] [{ offload_dev | xdpmeta_dev } *NAME*] [pinmaps *MAP_DIR*] [autoattach]
> >
> > +bpftool prog { load | loadall } *OBJ* *PATH* [type *TYPE*] [map { idx *IDX* | name *NAME* } *MAP*] [{ offload_dev | xdpmeta_dev } *NAME*] [pinmaps *MAP_DIR*] [autoattach] [kernel_btf *BTF_FILE*]
> >
>
> Woops, I just realised we also need to add kernel_btf to the command
>
> summary at the top of the document (line 34), sorry for missing it
It was my mistake to miss that part. I'll prepare an updated version soon. :)
Thanks.
> during the previous pass. Please add it, and mark v4 as:
>
> Reviewed-by: Quentin Monnet <qmo@xxxxxxxxxx>
>
> Thanks!
>