bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next] selftests/bpf: Fix selftest btf_tag/btf_type_tag_percpu_vmlinux_helper failure
@ 2025-05-29 20:11 Yonghong Song
  2025-05-31  0:24 ` JP Kobryn
  2025-06-01 20:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Yonghong Song @ 2025-05-29 20:11 UTC (permalink / raw)
  To: bpf
  Cc: Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann, kernel-team,
	Martin KaFai Lau, Ihor Solodrai, JP Kobryn

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/6f688f2e-7d26-423a-9029-d1b1ef1c938a@linux.dev/

Cc: Ihor Solodrai <ihor.solodrai@linux.dev>
Cc: JP Kobryn <inwardvessel@gmail.com>
Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
---
 tools/testing/selftests/bpf/progs/btf_type_tag_percpu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/bpf/progs/btf_type_tag_percpu.c b/tools/testing/selftests/bpf/progs/btf_type_tag_percpu.c
index 69f81cb555ca..d93f68024cc6 100644
--- a/tools/testing/selftests/bpf/progs/btf_type_tag_percpu.c
+++ b/tools/testing/selftests/bpf/progs/btf_type_tag_percpu.c
@@ -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;
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf-next] selftests/bpf: Fix selftest btf_tag/btf_type_tag_percpu_vmlinux_helper failure
  2025-05-29 20:11 [PATCH bpf-next] selftests/bpf: Fix selftest btf_tag/btf_type_tag_percpu_vmlinux_helper failure Yonghong Song
@ 2025-05-31  0:24 ` JP Kobryn
  2025-06-01 20:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: JP Kobryn @ 2025-05-31  0:24 UTC (permalink / raw)
  To: Yonghong Song
  Cc: Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann, bpf,
	kernel-team, Martin KaFai Lau, Ihor Solodrai

On 5/29/25 1:11 PM, Yonghong Song 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 == 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/6f688f2e-7d26-423a-9029-d1b1ef1c938a@linux.dev/
> 
> Cc: Ihor Solodrai <ihor.solodrai@linux.dev>
> Cc: JP Kobryn <inwardvessel@gmail.com>
> Signed-off-by: Yonghong Song <yonghong.song@linux.dev>

Acked-by: JP Kobryn <inwardvessel@gmail.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf-next] selftests/bpf: Fix selftest btf_tag/btf_type_tag_percpu_vmlinux_helper failure
  2025-05-29 20:11 [PATCH bpf-next] selftests/bpf: Fix selftest btf_tag/btf_type_tag_percpu_vmlinux_helper failure Yonghong Song
  2025-05-31  0:24 ` JP Kobryn
@ 2025-06-01 20:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-06-01 20:10 UTC (permalink / raw)
  To: Yonghong Song
  Cc: bpf, ast, andrii, daniel, kernel-team, martin.lau, ihor.solodrai,
	inwardvessel

Hello:

This patch was applied to bpf/bpf.git (master)
by Alexei Starovoitov <ast@kernel.org>:

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 == 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
> 
> [...]

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-06-01 20:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-29 20:11 [PATCH bpf-next] selftests/bpf: Fix selftest btf_tag/btf_type_tag_percpu_vmlinux_helper failure Yonghong Song
2025-05-31  0:24 ` JP Kobryn
2025-06-01 20:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).