From: Andrea Righi <arighi@nvidia.com>
To: Shaojie Sun <sunshaojie@kylinos.cn>
Cc: Tejun Heo <tj@kernel.org>,
sched-ext@lists.linux.dev, David Vernet <void@manifault.com>,
Emil Tsalapatis <emil@etsalapatis.com>,
Changwoo Min <changwoo@igalia.com>,
linux-kernel@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH] tools/sched_ext: Add "arena" BTF type tag to the __arena qualifier
Date: Fri, 20 Nov 2026 07:14:26 +0100 [thread overview]
Message-ID: <av_lQuuL5lgbW1BW@gpd4> (raw)
In-Reply-To: <20261119102613.811845-1-sunshaojie@kylinos.cn>
Hi Shaojie,
On Thu, Nov 19, 2026 at 06:26:13PM +0800, Shaojie Sun wrote:
> tools/testing/selftests/bpf/libarena marks __arena types with
> btf_type_tag("arena") so that whether a type belongs to an arena can be
> determined from BTF alone:
>
> commit a0fa68d8ce75 ("selftests/bpf: libarena: Add "arena" BTF type
> tag to __arena qualifier")
>
> tools/sched_ext defines the same __arena qualifier but without the
> "arena" BTF type tag. Add the tag so that both describe arena types the
> same way.
>
> checkpatch reports a false positive on the new definition:
>
> ERROR: Macros with complex values should be enclosed in parentheses
>
> The macro value is a sequence of declaration attributes, not an
> expression, so it can neither be parenthesized nor wrapped in a
> do-while loop. The selftests copy of the qualifier has the very same
> definition and triggers the same warning.
>
> Signed-off-by: Shaojie Sun <sunshaojie@kylinos.cn>
> ---
> tools/sched_ext/include/scx/bpf_arena_common.bpf.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/sched_ext/include/scx/bpf_arena_common.bpf.h b/tools/sched_ext/include/scx/bpf_arena_common.bpf.h
> index 2043d66940ea..fb796b356f86 100644
> --- a/tools/sched_ext/include/scx/bpf_arena_common.bpf.h
> +++ b/tools/sched_ext/include/scx/bpf_arena_common.bpf.h
> @@ -16,7 +16,7 @@
>
> #if defined(__BPF_FEATURE_ADDR_SPACE_CAST) && !defined(BPF_ARENA_FORCE_ASM)
> #ifndef __arena
> -#define __arena __attribute__((address_space(1)))
> +#define __arena __attribute__((address_space(1))) __attribute__((btf_type_tag("arena")))
Can you add the BTF type tag also to the fallback of __arena, so that it
covers older LLVM versions and BPF_ARENA_FORCE_ASM as well? (see below)
Longer term (not for this patch), we should probably move these
definitions into a shared BPF header used by both sched_ext and
libarena, to avoid keeping duplicate copies in sync. That can be a
separate cleanup.
With the change below:
Reviewed-by: Andrea Righi <arighi@nvidia.com>
Thanks,
-Andrea
tools/sched_ext/include/scx/bpf_arena_common.bpf.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/sched_ext/include/scx/bpf_arena_common.bpf.h b/tools/sched_ext/include/scx/bpf_arena_common.bpf.h
index fb796b356f864..9f63732181065 100644
--- a/tools/sched_ext/include/scx/bpf_arena_common.bpf.h
+++ b/tools/sched_ext/include/scx/bpf_arena_common.bpf.h
@@ -74,7 +74,7 @@
, [as]"i"((dst_as << 16) | src_as));
#endif
-#define __arena
+#define __arena __attribute__((btf_type_tag("arena")))
#define __arena_global SEC(".addr_space.1")
#define cast_kern(ptr) bpf_addr_space_cast(ptr, 0, 1)
#define cast_user(ptr) bpf_addr_space_cast(ptr, 1, 0)
> #endif
> #define __arena_global __attribute__((address_space(1)))
> #define cast_kern(ptr) /* nop for bpf prog. emitted by LLVM */
> --
> 2.50.1
>
prev parent reply other threads:[~2026-11-20 6:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 10:26 [PATCH] tools/sched_ext: Add "arena" BTF type tag to the __arena qualifier Shaojie Sun
2026-11-19 14:29 ` Tao Cui
2026-11-20 6:14 ` Andrea Righi [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=av_lQuuL5lgbW1BW@gpd4 \
--to=arighi@nvidia.com \
--cc=bpf@vger.kernel.org \
--cc=changwoo@igalia.com \
--cc=emil@etsalapatis.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sched-ext@lists.linux.dev \
--cc=sunshaojie@kylinos.cn \
--cc=tj@kernel.org \
--cc=void@manifault.com \
/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