Re: [PATCH bpf-next v3 3/8] selftests/bpf: report SKIP for arena tests a compiler cannot build
From: Alexei Starovoitov
Date: Mon Nov 02 2026 - 18:09:36 EST
On Mon, Nov 02, 2026 at 02:07 PM Vineet Gupta <vineet.gupta@xxxxxxxxx> wrote:
> Give each guard an #else with a dummy marked __skip(), so the skip gap is
> reported rather than invisible. Add __skip_without_arena for it, which
> expands to __skip() with a fixed reason when the compiler cannot do arena.
How about the following approach instead...
looks much simpler to me...
pw-bot: cr
diff --git a/tools/testing/selftests/bpf/progs/arena_kfunc_jit.c b/tools/testing/selftests/bpf/progs/arena_kfunc_jit.c
index b5a01cb..16c3dd9 100644
--- a/tools/testing/selftests/bpf/progs/arena_kfunc_jit.c
+++ b/tools/testing/selftests/bpf/progs/arena_kfunc_jit.c
@@ -23,8 +23,6 @@ struct {
/* volatile to force the scalar reloads below */
volatile u64 stash;
-#if defined(__BPF_FEATURE_ADDR_SPACE_CAST)
-
SEC("syscall")
__arch_x86_64
__jited("...")
@@ -93,6 +91,7 @@ __jited(" cbz w4, L0")
__jited(" add x4, x28, w4, uxtw")
__jited("L0: {{.*}}")
__success
+__skip_without_arena
int arena_arg_jit_args5(void *ctx)
{
u64 __arena *val;
@@ -113,6 +112,4 @@ int arena_arg_jit_args5(void *ctx)
return 0;
}
-#endif /* __BPF_FEATURE_ADDR_SPACE_CAST */
-
char _license[] SEC("license") = "GPL";
diff --git a/tools/testing/selftests/bpf/progs/bpf_misc.h b/tools/testing/selftests/bpf/progs/bpf_misc.h
index d7f706c..4ec840b 100644
--- a/tools/testing/selftests/bpf/progs/bpf_misc.h
+++ b/tools/testing/selftests/bpf/progs/bpf_misc.h
@@ -116,6 +116,10 @@
* feature the toolchain or JIT cannot provide, so a run does
* not report OK for coverage it never executed.
*
+ * __skip_without_arena
+ * __skip() when the compiler does not support the arena
+ * address space, nothing otherwise.
+ *
* __log_level Log level to use for the program, numeric value expected.
*
* __flag Adds one flag use for the program, the following values are valid:
@@ -156,6 +160,11 @@
#define __success __test_tag("test_expect_success")
#define __description(desc) __test_tag("test_description=" desc)
#define __skip(reason) __test_tag("test_skip=" reason)
+#ifdef __BPF_FEATURE_ADDR_SPACE_CAST
+#define __skip_without_arena
+#else
+#define __skip_without_arena __skip("compiler does not support the arena address space")
+#endif
#define __msg_unpriv(msg) __test_tag("test_expect_msg_unpriv=" msg)
#define __not_msg_unpriv(msg) __test_tag("test_expect_not_msg_unpriv=" msg)
#define __msg_next_unpriv(msg) __test_tag("test_expect_msg_next_unpriv=" msg)
diff --git a/tools/testing/selftests/bpf/progs/jit_insns_arena.c b/tools/testing/selftests/bpf/progs/jit_insns_arena.c
index 95736ea..77d135a 100644
--- a/tools/testing/selftests/bpf/progs/jit_insns_arena.c
+++ b/tools/testing/selftests/bpf/progs/jit_insns_arena.c
@@ -106,6 +106,14 @@ int cast_to_user(void *ctx)
: "r1", "r2", "r7", "r9");
return res != 0;
}
+#else
+SEC("socket")
+__skip_without_arena
+__success
+int arena_unsupported(void)
+{
+ return 0;
+}
#endif
char _license[] SEC("license") = "GPL";
diff --git a/tools/testing/selftests/bpf/progs/verifier_arena_large.c b/tools/testing/selftests/bpf/progs/verifier_arena_large.c
index dbdea14..428b984 100644
--- a/tools/testing/selftests/bpf/progs/verifier_arena_large.c
+++ b/tools/testing/selftests/bpf/progs/verifier_arena_large.c
@@ -181,7 +181,6 @@ int free_reserved(void *ctx)
return 0;
}
-#if defined(__BPF_FEATURE_ADDR_SPACE_CAST)
#define PAGE_CNT 100
__u8 __arena * __arena page[PAGE_CNT]; /* occupies the first page */
__u8 __arena *base;
@@ -220,6 +219,7 @@ __noinline int alloc_pages(int page_cnt, int pages_atonce, bool first_pass,
SEC("syscall")
__success __retval(0)
+__skip_without_arena
int big_alloc2(void *ctx)
{
__u8 __arena *pg;
@@ -290,9 +290,9 @@ int big_alloc2(void *ctx)
/* Nonsleepable because it binds to a socket program. */
SEC("socket")
__success __retval(0)
+__skip_without_arena
int big_alloc3(void *ctx)
{
-#if defined(__BPF_FEATURE_ADDR_SPACE_CAST)
char __arena *pages;
u64 i;
int err = 0;
@@ -314,16 +314,14 @@ int big_alloc3(void *ctx)
bpf_arena_free_pages(&arena, pages, LARGE_PAGE_CNT);
return err;
-#endif
- return 0;
}
/* SYSCALL programs are always sleepable. */
SEC("syscall")
__success __retval(0)
+__skip_without_arena
int big_alloc4(void *ctx)
{
-#if defined(__BPF_FEATURE_ADDR_SPACE_CAST)
char __arena *pages;
u64 i;
int err = 0;
@@ -345,8 +343,6 @@ int big_alloc4(void *ctx)
bpf_arena_free_pages(&arena, pages, LARGE_PAGE_CNT);
return err;
-#endif
- return 0;
}
-#endif
+
char _license[] SEC("license") = "GPL";