selftests/bpf: Fix selftest btf_tag/btf_type_tag_percpu_vmlinux_helper failure
Subsystems (3)
Yonghong Song
reviewerPATCH 1/1 selftests/bpf: Fix selftest btf_tag/btf_type_tag_percpu_vmlinux_helper failure
Ihor Solodrai reported selftest 'btf_tag/btf_type_tag_percpu_vmlinux_helper' failure ([1]) during 6.16 merge window. The failure log:
...
7: (15) if r0 == 0x0 goto pc+1 ; R0=ptr_css_rstat_cpu()
; *(volatile int *)rstat; @ btf_type_tag_percpu.c:68
8: (61) r1 = *(u32 *)(r0 +0)
cannot access ptr member updated_children with moff 0 in struct css_rstat_cpu with off 0 size 4
Two changes are needed. First, 'struct cgroup_rstat_cpu' needs to be replaced with 'struct css_rstat_cpu' to be consistent with new data structure. Second, layout of 'css_rstat_cpu' is changed compared to 'cgroup_rstat_cpu'. The first member becomes a pointer so the bpf prog needs to do 8-byte load instead of 4-byte load.
[1] https://lore.kernel.org/bpf/[email protected]/
--- tools/testing/selftests/bpf/progs/btf_type_tag_percpu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/testing/selftests/bpf/progs/btf_type_tag_percpu.c +3 -3
@@ -57,15 +57,15 @@ int BPF_PROG(test_percpu_load, struct cgroup *cgrp, const char *path) SEC("tp_btf/cgroup_mkdir")int BPF_PROG (test_percpu_helper ,struct cgroup *cgrp,const char *path) { -struct cgroup_rstat_cpu *rstat; +struct css_rstat_cpu *rstat;__u32 cpu; cpu =bpf_get_smp_processor_id (); - rstat = (struct cgroup_rstat_cpu *)bpf_per_cpu_ptr ( + rstat = (struct css_rstat_cpu *)bpf_per_cpu_ptr ( cgrp->self.rstat_cpu, cpu);if (rstat) {/* READ_ONCE */ - *(volatile int *)rstat; + *(volatile long *)rstat; }return 0 ;
Signature · 1 line
2.47.1
Quoted 15 lines · Yonghong Song
Ihor Solodrai reported selftest 'btf_tag/btf_type_tag_percpu_vmlinux_helper' failure ([1]) during 6.16 merge window. The failure log:
... 7: (15) if r0 == 0x0 goto pc+1 ; R0=ptr_css_rstat_cpu() ; *(volatile int *)rstat; @ btf_type_tag_percpu.c:68 8: (61) r1 = *(u32 *)(r0 +0) cannot access ptr member updated_children with moff 0 in struct css_rstat_cpu with off 0 size 4Two changes are needed. First, 'struct
cgroup_rstat_cpu' needs to be replaced with 'structcss_rstat_cpu' to be consistent with new data structure. Second, layout of 'css_rstat_cpu' is changed compared to 'cgroup_rstat_cpu'. The first member becomes a pointer so the bpf prog needs to do 8-byte load instead of 4-byte load.
Quoted 5 lines
[1] https://lore.kernel.org/bpf/[email protected]/Cc Ihor Solodrai <[email protected]>Cc JP Kobryn <[email protected]>Signed-off-by Yonghong Song <[email protected]>
This patch was applied to bpf/bpf.git (master) by Alexei Starovoitov <[email protected]>:
Hello:
This patch was applied to bpf/bpf.git (master)
by Alexei Starovoitov <[email protected]>:
Quoted 10 lines · On Thu, 29 May 2025 13:11:51 -0700 you wrote:
Ihor Solodrai reported selftest 'btf_tag/btf_type_tag_percpu_vmlinux_helper' failure ([1]) during 6.16 merge window. The failure log:
...
7: (15) if r0 ==0x0goto pc+1 ; R0=ptr_css_rstat_cpu()
; *(volatile int *)rstat; @ btf_type_tag_percpu.c:68
8: (61) r1 = *(u32 *)(r0 +0)
cannot access ptr memberupdated_childrenwith moff 0 in structcss_rstat_cpuwith off 0 size 4[...]
Here is the summary with links:
- [bpf-next] selftests/bpf: Fix selftest btf_tag/btf_type_tag_percpu_vmlinux_helper failure
https://git.kernel.org/bpf/bpf/c/baa39c169dd5
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html