Hi Alan, I see in your cover letter that you tried to address the nits from my review on v3 for patch 11, but it seems the changes got lost at some point, please double-check. 2024-05-17 11:23 UTC+0100 ~ Alan Maguire <alan.maguire@xxxxxxxxxx> > If the -R <base_btf> option is used, we can display BTF that has been > generated with distilled base BTF in its relocated form. For example > for bpf_testmod.ko (which is built as an out-of-tree module, so has > a distilled .BTF.base section: > > bpftool btf dump file bpf_testmod.ko > > Alternatively, we can display content relocated with > (a possibly changed) base BTF via > > bpftool btf dump -R /sys/kernel/btf/vmlinux bpf_testmod.ko > > The latter mirrors how the kernel will handle such split > BTF; it relocates its representation with the running > kernel, and if successful, renumbers BTF ids to reference > the current vmlinux BTF. > > Signed-off-by: Alan Maguire <alan.maguire@xxxxxxxxxx> > Acked-by: Eduard Zingerman <eddyz87@xxxxxxxxx> > Reviewed-by: Quentin Monnet <qmo@xxxxxxxxxx> > --- > tools/bpf/bpftool/Documentation/bpftool-btf.rst | 15 ++++++++++++++- > tools/bpf/bpftool/bash-completion/bpftool | 7 ++++--- > tools/bpf/bpftool/btf.c | 11 ++++++++++- > tools/bpf/bpftool/main.c | 14 +++++++++++++- > tools/bpf/bpftool/main.h | 2 ++ > 5 files changed, 43 insertions(+), 6 deletions(-) > > diff --git a/tools/bpf/bpftool/Documentation/bpftool-btf.rst b/tools/bpf/bpftool/Documentation/bpftool-btf.rst > index 3f6bca03ad2e..b11abebeae81 100644 > --- a/tools/bpf/bpftool/Documentation/bpftool-btf.rst > +++ b/tools/bpf/bpftool/Documentation/bpftool-btf.rst > @@ -16,7 +16,7 @@ SYNOPSIS > > **bpftool** [*OPTIONS*] **btf** *COMMAND* > > -*OPTIONS* := { |COMMON_OPTIONS| | { **-B** | **--base-btf** } } > +*OPTIONS* := { |COMMON_OPTIONS| | { **-B** | **--base-btf** } { **-R** | **relocate-base-btf** } } Please add the missing double-dash on --relocate-base-btf [...] > diff --git a/tools/bpf/bpftool/main.c b/tools/bpf/bpftool/main.c > index 08d0ac543c67..69d4906bec5c 100644 > --- a/tools/bpf/bpftool/main.c > +++ b/tools/bpf/bpftool/main.c > @@ -32,6 +32,8 @@ bool verifier_logs; > bool relaxed_maps; > bool use_loader; > struct btf *base_btf; > +struct btf *relocate_base_btf; > +const char *relocate_base_btf_path; > struct hashmap *refs_table; > > static void __noreturn clean_and_exit(int i) > @@ -448,6 +450,7 @@ int main(int argc, char **argv) > { "debug", no_argument, NULL, 'd' }, > { "use-loader", no_argument, NULL, 'L' }, > { "base-btf", required_argument, NULL, 'B' }, > + { "relocate-base-btf", required_argument, NULL, 'R' }, And please use tabs here. Thanks, Quentin