[PATCH bpf-next 2/2] selftests/bpf: Skip libarena on kernels with too many possible CPUs
From: Qiliang Yuan
Date: Thu Oct 08 2026 - 21:51:00 EST
serial_test_libarena runs every test program of libarena, most of them
after resetting the buddy allocator with arena_buddy_reset.
The buddy allocator takes an arena spin lock, which fails with
-EOPNOTSUPP on kernels built with more than 1024 possible CPUs, as
distributions commonly configure them. Every test then fails at
arena_buddy_reset, while the arena_spin_lock test already skips in that
case.
Reset the allocator once before running the tests, and skip them when
that returns -EOPNOTSUPP.
Fixes: b1487dc1b181 ("selftests/bpf: Add selftests for libarena buddy allocator")
Signed-off-by: Qiliang Yuan <odys.yuan@xxxxxxxxx>
---
tools/testing/selftests/bpf/prog_tests/libarena.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/tools/testing/selftests/bpf/prog_tests/libarena.c b/tools/testing/selftests/bpf/prog_tests/libarena.c
index daade4150af66..070a08856ee04 100644
--- a/tools/testing/selftests/bpf/prog_tests/libarena.c
+++ b/tools/testing/selftests/bpf/prog_tests/libarena.c
@@ -240,6 +240,15 @@ void serial_test_libarena(void)
if (!ASSERT_OK(ret, "arena_alloc_reserve"))
goto out;
+ /* Skip on kernels with more possible CPUs than arena spin locks support */
+ ret = libarena_run_prog(bpf_program__fd(skel->progs.arena_buddy_reset));
+ if (ret == -EOPNOTSUPP) {
+ test__skip();
+ goto out;
+ }
+ if (!ASSERT_OK(ret, "arena_buddy_reset"))
+ goto out;
+
bpf_object__for_each_program(prog, skel->obj) {
const char *name = bpf_program__name(prog);
--
2.43.0