mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vineet Gupta <vineet.gupta@linux.dev>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>, bpf@vger.kernel.org
Cc: daniel@iogearbox.net, andrii@kernel.org, eddyz87@gmail.com,
	memxor@gmail.com, martin.lau@linux.dev, song@kernel.org,
	yonghong.song@linux.dev, jolsa@kernel.org, emil@etsalapatis.com,
	ihor.solodrai@linux.dev, john.fastabend@gmail.com,
	shuah@kernel.org, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org, jose.marchesi@oracle.com,
	david.faust@oss.qualcomm.com
Subject: Re: [PATCH bpf-next v3 8/8] selftests/bpf: skip the struct_ops arena tests without compiler support
Date: Mon, 2 Nov 2026 16:17:30 -0800	[thread overview]
Message-ID: <daeba59a-62c0-4c24-a9d4-014c238e34db@linux.dev> (raw)
In-Reply-To: <DML33YRVJEMW.2HUSMGKYHA4HT@gmail.com>

On 11/2/26 2:39 PM, Alexei Starovoitov wrote:
> On Mon, Nov 02, 2026 at 02:07 PM Vineet Gupta <vineet.gupta@linux.dev> wrote:
>> These are not driven by test_loader, so __skip_without_arena does not
>> reach them.  Use the flag-in-.data pattern linked_externs.c already
>> uses for the same situation: the program exports skip_tests, and the
>> host checks it before attaching and reports SKIP.
> cast_kern() is cleaner...
> It's a nop when the compiler supports arena.

Nice, definitely better than what I had since now more code is exercised 
than being skipped.

Thx,
-Vineet

> diff --git a/tools/testing/selftests/bpf/progs/struct_ops_arena.c b/tools/testing/selftests/bpf/progs/struct_ops_arena.c
> index 8aa8639..3fffa24 100644
> --- a/tools/testing/selftests/bpf/progs/struct_ops_arena.c
> +++ b/tools/testing/selftests/bpf/progs/struct_ops_arena.c
> @@ -86,7 +86,6 @@ struct bpf_testmod_ops3 testmod_arena = {
>   SEC("syscall")
>   int trigger(void *ctx)
>   {
> -#if defined(__BPF_FEATURE_ADDR_SPACE_CAST)
>   	u64 __arena *val;
>   	int ret;
>
> @@ -94,6 +93,7 @@ int trigger(void *ctx)
>   	if (!val)
>   		return 1;
>
> +	cast_kern(val);
>   	*val = 41;
>   	ret = bpf_testmod_ops3_call_test_arena((u64 *)val);
>   	if (ret)
> @@ -134,6 +134,5 @@ int trigger(void *ctx)
>   		return 11;
>
>   	bpf_arena_free_pages(&arena, (void __arena *)val, 1);
> -#endif
>   	return 0;
>   }
> diff --git a/tools/testing/selftests/bpf/progs/struct_ops_arena_autobind.c b/tools/testing/selftests/bpf/progs/struct_ops_arena_autobind.c
> index 495faa0..3455ca9 100644
> --- a/tools/testing/selftests/bpf/progs/struct_ops_arena_autobind.c
> +++ b/tools/testing/selftests/bpf/progs/struct_ops_arena_autobind.c
> @@ -45,13 +45,13 @@ int unrelated(void *ctx)
>   SEC("syscall")
>   int trigger(void *ctx)
>   {
> -#if defined(__BPF_FEATURE_ADDR_SPACE_CAST)
>   	u64 __arena *val;
>
>   	val = bpf_arena_alloc_pages(&arena, NULL, 1, NUMA_NO_NODE, 0);
>   	if (!val)
>   		return 1;
>
> +	cast_kern(val);
>   	*val = 41;
>   	if (bpf_testmod_ops3_call_test_arena((u64 *)val))
>   		return 2;
> @@ -59,6 +59,5 @@ int trigger(void *ctx)
>   		return 3;
>
>   	bpf_arena_free_pages(&arena, (void __arena *)val, 1);
> -#endif
>   	return 0;
>   }
> diff --git a/tools/testing/selftests/bpf/progs/struct_ops_arena_member.c b/tools/testing/selftests/bpf/progs/struct_ops_arena_member.c
> index a2218cd..afbe59f 100644
> --- a/tools/testing/selftests/bpf/progs/struct_ops_arena_member.c
> +++ b/tools/testing/selftests/bpf/progs/struct_ops_arena_member.c
> @@ -80,7 +80,6 @@ struct bpf_testmod_ops3 testmod_arena_member = {
>   SEC("syscall")
>   int trigger(void *ctx)
>   {
> -#if defined(__BPF_FEATURE_ADDR_SPACE_CAST)
>   	u64 __arena *val;
>   	int ret;
>
> @@ -88,6 +87,7 @@ int trigger(void *ctx)
>   	if (!val)
>   		return 1;
>
> +	cast_kern(val);
>   	*val = 41;
>   	ret = bpf_testmod_ops3_call_test_arena_member((u64 *)val);
>   	if (ret)
> @@ -104,6 +104,5 @@ int trigger(void *ctx)
>   		return 4;
>
>   	bpf_arena_free_pages(&arena, (void __arena *)val, 1);
> -#endif
>   	return 0;
>   }
> diff --git a/tools/testing/selftests/bpf/progs/struct_ops_arena_member_render.c b/tools/testing/selftests/bpf/progs/struct_ops_arena_member_render.c
> index 09b4c74..c4e134e 100644
> --- a/tools/testing/selftests/bpf/progs/struct_ops_arena_member_render.c
> +++ b/tools/testing/selftests/bpf/progs/struct_ops_arena_member_render.c
> @@ -63,7 +63,6 @@ struct bpf_testmod_ops3 testmod_arena_member_render = {
>   SEC("syscall")
>   int trigger(void *ctx)
>   {
> -#if defined(__BPF_FEATURE_ADDR_SPACE_CAST)
>   	u64 __arena *val;
>   	int ret;
>
> @@ -71,6 +70,7 @@ int trigger(void *ctx)
>   	if (!val)
>   		return 1;
>
> +	cast_kern(val);
>   	*val = 41;
>   	ret = bpf_testmod_ops3_call_test_arena_member((u64 *)val);
>   	if (ret)
> @@ -80,6 +80,5 @@ int trigger(void *ctx)
>   		return 3;
>
>   	bpf_arena_free_pages(&arena, (void __arena *)val, 1);
> -#endif
>   	return 0;
>   }


      reply	other threads:[~2026-11-03  0:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-02 22:07 [PATCH bpf-next v3 0/8] selftests/bpf: cleanup bpf-gcc runs Vineet Gupta
2026-11-02 22:07 ` [PATCH bpf-next v3 1/8] selftests/bpf: Build callx tests with GCC that defines __BPF_FEATURE_CALLX Vineet Gupta
2026-11-02 22:07 ` [PATCH bpf-next v3 2/8] selftests/bpf: don't pass clang-only warning flags to GCC Vineet Gupta
2026-11-02 22:07 ` [PATCH bpf-next v3 3/8] selftests/bpf: report SKIP for arena tests a compiler cannot build Vineet Gupta
2026-11-02 22:36   ` Alexei Starovoitov
2026-11-03  0:24     ` Vineet Gupta
2026-11-02 22:07 ` [PATCH bpf-next v3 4/8] selftests/bpf: make arena_base() opaque to GCC's -Warray-bounds Vineet Gupta
2026-11-02 22:38   ` Alexei Starovoitov
2026-11-03  0:15     ` Vineet Gupta
2026-11-02 22:07 ` [PATCH bpf-next v3 5/8] selftests/bpf: don't report arena tests as passing with an empty body Vineet Gupta
2026-11-02 22:07 ` [PATCH bpf-next v3 6/8] selftests/bpf: cast explicitly in the arena subprog and callback faults Vineet Gupta
2026-11-02 22:07 ` [PATCH bpf-next v3 7/8] selftests/bpf: write the mixed arena/scalar ALU tests in asm Vineet Gupta
2026-11-02 22:07 ` [PATCH bpf-next v3 8/8] selftests/bpf: skip the struct_ops arena tests without compiler support Vineet Gupta
2026-11-02 22:39   ` Alexei Starovoitov
2026-11-03  0:17     ` Vineet Gupta [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=daeba59a-62c0-4c24-a9d4-014c238e34db@linux.dev \
    --to=vineet.gupta@linux.dev \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=david.faust@oss.qualcomm.com \
    --cc=eddyz87@gmail.com \
    --cc=emil@etsalapatis.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=jose.marchesi@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®