* [PATCH] tools/sched_ext: Add "arena" BTF type tag to the __arena qualifier
@ 2026-11-19 10:26 Shaojie Sun
2026-11-19 14:29 ` Tao Cui
0 siblings, 1 reply; 2+ messages in thread
From: Shaojie Sun @ 2026-11-19 10:26 UTC (permalink / raw)
To: Tejun Heo, sched-ext, David Vernet, Andrea Righi, Changwoo Min
Cc: linux-kernel, bpf, Shaojie Sun
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")))
#endif
#define __arena_global __attribute__((address_space(1)))
#define cast_kern(ptr) /* nop for bpf prog. emitted by LLVM */
--
2.50.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] tools/sched_ext: Add "arena" BTF type tag to the __arena qualifier
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
0 siblings, 0 replies; 2+ messages in thread
From: Tao Cui @ 2026-11-19 14:29 UTC (permalink / raw)
To: Shaojie Sun, Tejun Heo, sched-ext, David Vernet, Andrea Righi,
Changwoo Min
Cc: cui.tao, linux-kernel, bpf
Hello, Shaojie,
在 2026/11/19 18:26, Shaojie Sun 写道:
> 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.
>
Looks good. Tested on sched_ext for-next: all tools/sched_ext scheds
build and scx_sdt loads and runs fine with the tags present in the
BTF of the loaded program.
One nit: the patch doesn't apply to the current tree since
0a5e9cf2525f ("sched_ext: Sync common and compat headers from the scx
repo") changed the context line to "#elif", please rebase (git am -3
works meanwhile).
Also, this header also lives in the sched-ext/scx repo and the two
copies get reconciled by hand; the most recent reconciliation went
from the scx repo into the kernel tree. The scx repo copy doesn't
have the tag either, so it needs the same change there or the next
reconciliation will overwrite this one.
Tested-by: Tao Cui <cuitao@kylinos.cn>
> 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")))
> #endif
> #define __arena_global __attribute__((address_space(1)))
> #define cast_kern(ptr) /* nop for bpf prog. emitted by LLVM */
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-19 14:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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®