* a small question about bpftool struct_ops
@ 2023-05-19 12:07 Zhouyi Zhou
2023-05-19 19:01 ` Martin KaFai Lau
0 siblings, 1 reply; 6+ messages in thread
From: Zhouyi Zhou @ 2023-05-19 12:07 UTC (permalink / raw)
To: bpf, linux-kernel
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
libbpf: failed to load object 'bpf_cubic.bpf.o'
The host OS I used to compile the kernel and bpf is Ubuntu 23.04, the
guest OS that I run bpftool is Ubuntu 22.04.
I have stumbled on this for several days, could you help me by guidance my way?
Thanks in advance
Zhouyi
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: a small question about bpftool struct_ops
2023-05-19 12:07 a small question about bpftool struct_ops Zhouyi Zhou
@ 2023-05-19 19:01 ` Martin KaFai Lau
2023-05-19 23:37 ` Zhouyi Zhou
2023-05-31 3:14 ` Zhouyi Zhou
0 siblings, 2 replies; 6+ messages in thread
From: Martin KaFai Lau @ 2023-05-19 19:01 UTC (permalink / raw)
To: Zhouyi Zhou, bpf, linux-kernel
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: a small question about bpftool struct_ops
2023-05-19 19:01 ` Martin KaFai Lau
@ 2023-05-19 23:37 ` Zhouyi Zhou
2023-05-21 8:27 ` Zhouyi Zhou
2023-05-31 3:14 ` Zhouyi Zhou
1 sibling, 1 reply; 6+ messages in thread
From: Zhouyi Zhou @ 2023-05-19 23:37 UTC (permalink / raw)
To: Martin KaFai Lau; +Cc: bpf, linux-kernel
Thank you for responding so quickly ;-)
On Sat, May 20, 2023 at 3:01 AM Martin KaFai Lau <martin.lau@linux.dev> 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
OK
[214398] STRUCT 'bpf_struct_ops_tcp_congestion_ops' size=256 vlen=3
'refcnt' type_id=298 bits_offset=0
'state' type_id=214224 bits_offset=32
'data' type_id=213704 bits_offset=512
Please tell me if I could provide any further information.
You are of great help
Thank you very much
Zhouyi
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: a small question about bpftool struct_ops
2023-05-19 23:37 ` Zhouyi Zhou
@ 2023-05-21 8:27 ` Zhouyi Zhou
2023-05-26 23:10 ` Zhouyi Zhou
0 siblings, 1 reply; 6+ messages in thread
From: Zhouyi Zhou @ 2023-05-21 8:27 UTC (permalink / raw)
To: Martin KaFai Lau; +Cc: bpf, linux-kernel
Hi
On Sat, May 20, 2023 at 7:37 AM Zhouyi Zhou <zhouzhouyi@gmail.com> wrote:
>
> Thank you for responding so quickly ;-)
>
> On Sat, May 20, 2023 at 3:01 AM Martin KaFai Lau <martin.lau@linux.dev> 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
> OK
> [214398] STRUCT 'bpf_struct_ops_tcp_congestion_ops' size=256 vlen=3
> 'refcnt' type_id=298 bits_offset=0
> 'state' type_id=214224 bits_offset=32
> 'data' type_id=213704 bits_offset=512
>
> Please tell me if I could provide any further information.
>
> You are of great help
>
> Thank you very much
> Zhouyi
Thanks for your help
Or, can you teach me how to prepare an environment that can run
"bpftool struct_ops register xxx.o" ;-)
(A few words of description of OS version (Ubuntu/CentOS/Suse for etc)
and example kernel .config is enough)
I am an enthusiastic learner ;-)
Thanks in advance
Zhouyi
> >
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: a small question about bpftool struct_ops
2023-05-21 8:27 ` Zhouyi Zhou
@ 2023-05-26 23:10 ` Zhouyi Zhou
0 siblings, 0 replies; 6+ messages in thread
From: Zhouyi Zhou @ 2023-05-26 23:10 UTC (permalink / raw)
To: Martin KaFai Lau; +Cc: bpf, linux-kernel
Hi
On Sun, May 21, 2023 at 4:27 PM Zhouyi Zhou <zhouzhouyi@gmail.com> wrote:
>
> Hi
>
> On Sat, May 20, 2023 at 7:37 AM Zhouyi Zhou <zhouzhouyi@gmail.com> wrote:
> >
> > Thank you for responding so quickly ;-)
> >
> > On Sat, May 20, 2023 at 3:01 AM Martin KaFai Lau <martin.lau@linux.dev> 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
> > OK
> > [214398] STRUCT 'bpf_struct_ops_tcp_congestion_ops' size=256 vlen=3
> > 'refcnt' type_id=298 bits_offset=0
> > 'state' type_id=214224 bits_offset=32
> > 'data' type_id=213704 bits_offset=512
> >
> > Please tell me if I could provide any further information.
> >
> > You are of great help
> >
> > Thank you very much
> > Zhouyi
> Thanks for your help
>
> Or, can you teach me how to prepare an environment that can run
> "bpftool struct_ops register xxx.o" ;-)
> (A few words of description of OS version (Ubuntu/CentOS/Suse for etc)
> and example kernel .config is enough)
I invoke following commands, and it works:
cd tools/testing/selftests/bpf
find . -name vmlinux.h|xargs rm
make -j 20
put bpf_cubic.bpf.o to my virtual machine, and it works!
I don't know why
Thank you all!
Best Regards
Zhouyi
>
> I am an enthusiastic learner ;-)
>
> Thanks in advance
> Zhouyi
> > >
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: a small question about bpftool struct_ops
2023-05-19 19:01 ` Martin KaFai Lau
2023-05-19 23:37 ` Zhouyi Zhou
@ 2023-05-31 3:14 ` Zhouyi Zhou
1 sibling, 0 replies; 6+ messages in thread
From: Zhouyi Zhou @ 2023-05-31 3:14 UTC (permalink / raw)
To: Martin KaFai Lau; +Cc: bpf, linux-kernel
Hi
On Sat, May 20, 2023 at 3:01 AM Martin KaFai Lau <martin.lau@linux.dev> 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@aurel32.net/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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-05-31 3:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-19 12:07 a small question about bpftool struct_ops Zhouyi Zhou
2023-05-19 19:01 ` Martin KaFai Lau
2023-05-19 23:37 ` Zhouyi Zhou
2023-05-21 8:27 ` Zhouyi Zhou
2023-05-26 23:10 ` Zhouyi Zhou
2023-05-31 3:14 ` Zhouyi Zhou
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox