On Mon, 1 Jun 2020 at 17:27, Lorenz Bauer <lmb@xxxxxxxxxxxxxx> wrote: > > On Mon, 1 Jun 2020 at 16:13, Yonghong Song <yhs@xxxxxx> wrote: > > > > > > On 6/1/20 7:42 AM, Lorenz Bauer wrote: > > > For some reason the initial e-mail wasn't plain text, apologies. > > > > > > ---------- Forwarded message --------- > > > From: Lorenz Bauer <lmb@xxxxxxxxxxxxxx> > > > Date: Mon, 1 Jun 2020 at 15:32 > > > Subject: Trouble running bpf_iter tests > > > To: Yonghong Song <yhs@xxxxxx>, bpf <bpf@xxxxxxxxxxxxxxx> > > > Cc: kernel-team <kernel-team@xxxxxxxxxxxxxx> > > > > > > > > > Hi Yonghong, > > > > > > I'm having trouble running the bpf_iter tests on bpf-next at 551f08b1d8eadbc. > > > On a freshly built kernel running in a VM I get the following: > > > > > > root@vm:/home/lorenz/dev/bpf-next/tools/testing/selftests/bpf# > > > ./test_progs -t bpf_iter > > > 510 bits_offset=640 > > > #3/1 btf_id_or_null:OK > > > libbpf: failed to open system Kconfig > > > libbpf: failed to load object 'bpf_iter_ipv6_route' > > > libbpf: failed to load BPF skeleton 'bpf_iter_ipv6_route': -22 > > > test_ipv6_route:FAIL:bpf_iter_ipv6_route__open_and_load skeleton > > > open_and_load failed1510 bits_offset=1024 > > > #3/2 ipv6_route:FAIL > > > libbpf: netlink is not found in vmlinux BTF > > > libbpf: failed to load object 'bpf_iter_netlink' > > > libbpf: failed to load BPF skeleton 'bpf_iter_netlink': -2 > > > test_netlink:FAIL:bpf_iter_netlink__open_and_load skeleton > > > open_and_load failed1510 bits_offset=1408 > > > #3/3 netlink:FAIL > > > libbpf: bpf_map is not found in vmlinux BTF > > > libbpf: failed to load object 'bpf_iter_bpf_map' > > > libbpf: failed to load BPF skeleton 'bpf_iter_bpf_map': -2 > > > test_bpf_map:FAIL:bpf_iter_bpf_map__open_and_load skeleton > > > open_and_load failed > > > #3/4 bpf_map:FAIL > > > .... > > > #3 bpf_iter:FAIL > > > Summary: 0/1 PASSED, 0 SKIPPED, 12 FAILED > > > > > > If I understand correctly, this is because there is no function > > > information for bpf_iter_bpf_map > > > present in my /sys/kernel/btf/vmlinux: > > > > > > # ./bpftool btf dump file /sys/kernel/btf/vmlinux format raw | > > > grep bpf_iter_bpf_map > > > # > > > > Yes, this is the reason. > > > > > > > > There is an entry in /proc/kallsyms however: > > > > > > # grep bpf_iter_bpf_map /proc/kallsyms > > > ffffffff826b2f13 T bpf_iter_bpf_map > > That means the kernel actually haves the right information. > > > > > > And other bpf_iter related symbols are available in BTF: > > > > > > # ./bpftool btf dump file /sys/kernel/btf/vmlinux format raw | > > > grep bpf_iter_ > > > [12602] TYPEDEF 'bpf_iter_init_seq_priv_t' type_id=9310 > > > [12603] TYPEDEF 'bpf_iter_fini_seq_priv_t' type_id=352 > > > [12604] STRUCT 'bpf_iter_reg' size=56 vlen=7 > > > [12608] STRUCT 'bpf_iter_meta' size=24 vlen=3 > > > [12609] STRUCT 'bpf_iter_target_info' size=32 vlen=3 > > > [12611] STRUCT 'bpf_iter_link' size=72 vlen=2 > > > [12613] STRUCT 'bpf_iter_priv_data' size=40 vlen=6 > > > [12617] STRUCT 'bpf_iter_seq_map_info' size=4 vlen=1 > > > [12620] STRUCT 'bpf_iter__bpf_map' size=16 vlen=2 > > > [12622] STRUCT 'bpf_iter_seq_task_common' size=8 vlen=1 > > > [12623] STRUCT 'bpf_iter_seq_task_info' size=16 vlen=2 > > > [12625] STRUCT 'bpf_iter__task' size=16 vlen=2 > > > [12626] STRUCT 'bpf_iter_seq_task_file_info' size=32 vlen=5 > > > [12628] STRUCT 'bpf_iter__task_file' size=32 vlen=4 > > > [25591] STRUCT 'bpf_iter__netlink' size=16 vlen=2 > > > [27509] STRUCT 'bpf_iter__ipv6_route' size=16 vlen=2 > > > > > > Can you help me make this work? > > > > Looks like you have old pahole in your system. You need pahole 1.16 or later > > > > to enable global functions emitted to vmlinux BTF. Could you give a try? > > Indeed, upgrading to v1.17 fixed the issue! Thanks for your help :) Thinking about this some more, could we make the kernel build depend on pahole > 1.15? I foresee a future where distro kernels are built with old pahole and therefore we don't get access to bpf_iter even on new kernels. Right now it's very easy to miss this. -- Lorenz Bauer | Systems Engineer 6th Floor, County Hall/The Riverside Building, SE1 7PB, UK www.cloudflare.com