From fcda8096dc5d9cabe86a5bab7fa514d01b5011a7 Mon Sep 17 00:00:00 2001 From: Alexei Starovoitov Date: Sat, 31 Oct 2026 21:55:36 +0000 Subject: [PATCH] selftests/bpf: Don't cast a pointer to .bss in arena_htab_asm arena_htab_asm is arena_htab.c with BPF_ARENA_FORCE_ASM. In this variant __arena has no address space, so arr1 is in .bss, and cast_kern() is a real insn. cast_kern(arr) turns the pointer to .bss into an offset in the arena. Each of the 100000 stores to arr[i] faults, and the fault handler of the arena skips it. Remove the cast. In the other variant it is a nop. The prog takes 67 ms in place of 950 ms on a kernel with lockdep. With one time slice for all may_goto of a prog, may_goto stops the loops of the old prog after 250 ms. The test does not see that, because it looks at the first keys only. Signed-off-by: Alexei Starovoitov Link: https://patch.msgid.link/20261031215543.682284-3-alexei.starovoitov@gmail.com --- tools/testing/selftests/bpf/progs/arena_htab.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/testing/selftests/bpf/progs/arena_htab.c b/tools/testing/selftests/bpf/progs/arena_htab.c index 81eaa94afeb0..80cc14bb1c0f 100644 --- a/tools/testing/selftests/bpf/progs/arena_htab.c +++ b/tools/testing/selftests/bpf/progs/arena_htab.c @@ -34,8 +34,6 @@ int arena_htab_llvm(void *ctx) cast_kern(htab); htab_init(htab); - cast_kern(arr); - /* first run. No old elems in the table */ for (i = zero; i < 100000 && can_loop; i++) { htab_update_elem(htab, i, i);