Re: a small question about bpftool struct_ops

From: Zhouyi Zhou
Date: Tue May 30 2023 - 23:15:38 EST


Hi

On Sat, May 20, 2023 at 3:01 AM Martin KaFai Lau <martin.lau@xxxxxxxxx> wrote:
>
> On 5/19/23 5:07 AM, Zhouyi Zhou wrote:
> > Dear developers:
> > I compiled bpftool and bpf tests in mainline (2d1bcbc6cd70),
> > but when I invoke:
> > bpftool struct_ops register bpf_cubic.bpf.o
> >
> > the command line fail with:
> > libbpf: struct_ops init_kern: struct tcp_congestion_ops data is not
> > found in struct bpf_struct_ops_tcp_congestion_ops
>
> At the machine trying to register the bpf_cubic, please dump the vmlinux btf and
> search for bpf_struct_ops_tcp_congestion_ops and paste it here:
>
> For example:
> #> bpftool btf dump file /sys/kernel/btf/vmlinux
>
> ...
>
> [74578] STRUCT 'bpf_struct_ops_tcp_congestion_ops' size=256 vlen=3
> 'refcnt' type_id=145 bits_offset=0
> 'state' type_id=74569 bits_offset=32
> 'data' type_id=6241 bits_offset=512
>
Exciting news:
when I construct the kernel package, I found lots of following warnings:
WARN: multiple IDs found for 'task_struct': 241, 21719 - using 241
WARN: multiple IDs found for 'vm_area_struct': 360, 21750 - using 360
WARN: multiple IDs found for 'file': 805, 21789 - using 805
WARN: multiple IDs found for 'cgroup': 666, 21819 - using 666
WARN: multiple IDs found for 'inode': 928, 21936 - using 928
WARN: multiple IDs found for 'path': 960, 21965 - using 960

These warnings lead me to:
Link: https://lore.kernel.org/lkml/ZBovCrMXJk7NPISp@xxxxxxxxxxx/T/

So, I upgraded my pahole from [1], and construct the kernel package
again, now I can successfully invoke
bpftool struct_ops register bpf_cubic.bpf.o

[1] https://github.com/acmel/dwarves.git

Sorry for the previous noise

and

Thanks again
Best Regards
Zhouyi