Skip to content

Commit baa39c1

Browse files
Yonghong SongAlexei Starovoitov
authored andcommitted
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]/ Cc: Ihor Solodrai <[email protected]> Cc: JP Kobryn <[email protected]> Signed-off-by: Yonghong Song <[email protected]> Acked-by: JP Kobryn <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 4b65d5a commit baa39c1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tools/testing/selftests/bpf/progs/btf_type_tag_percpu.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ int BPF_PROG(test_percpu_load, struct cgroup *cgrp, const char *path)
5757
SEC("tp_btf/cgroup_mkdir")
5858
int BPF_PROG(test_percpu_helper, struct cgroup *cgrp, const char *path)
5959
{
60-
struct cgroup_rstat_cpu *rstat;
60+
struct css_rstat_cpu *rstat;
6161
__u32 cpu;
6262

6363
cpu = bpf_get_smp_processor_id();
64-
rstat = (struct cgroup_rstat_cpu *)bpf_per_cpu_ptr(
64+
rstat = (struct css_rstat_cpu *)bpf_per_cpu_ptr(
6565
cgrp->self.rstat_cpu, cpu);
6666
if (rstat) {
6767
/* READ_ONCE */
68-
*(volatile int *)rstat;
68+
*(volatile long *)rstat;
6969
}
7070

7171
return 0;

0 commit comments

Comments
 (0)