tools/sched_ext: Add "arena" BTF type tag to the __arena qualifier
Subsystems (2)
PATCH v2 1/1 tools/sched_ext: Add "arena" BTF type tag to the __arena qualifier
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. Add it to the fallback definition too so that older LLVM versions and BPF_ARENA_FORCE_ASM builds record the tag as well.
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.
---
Changes in v2:
- Add the tag to the fallback definition of __arena as well, so that older LLVM versions and BPF_ARENA_FORCE_ASM builds record it too (Andrea Righi).
tools/sched_ext/include/scx/bpf_arena_common.bpf.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/sched_ext/include/scx/bpf_arena_common.bpf.h +2 -2
@@ -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 */
@@ -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)
Signature · 1 line
2.50.1
Applied to sched_ext/for-7.5.
Thanks.
--
tejun