Skip to contentSkip to conversation

tools/sched_ext: scx_qmap: Fix qa arena placement

PATCH In review Cheng-Yang Chou 2 participants 2 messages May 13 Scheduler - sched_ext

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/sched_ext: scx_qmap: Fix qa arena placement

__arena is a pointer qualifier meaning "this pointer points to arena memory". When used on a global variable declaration, it expands to nothing in scx's build because __BPF_FEATURE_ADDR_SPACE_CAST is never defined, leaving qa as a plain global in BSS. bpftool then generates skel->bss->qa instead of the expected skel->arena->qa, causing:

scx_qmap.c: error: 'struct scx_qmap' has no member named 'arena'

__arena_global is the correct annotation for global variables that reside in the arena. When __BPF_FEATURE_ADDR_SPACE_CAST is not defined it expands to SEC(".addr_space.1"), placing qa in the arena ELF section. When __BPF_FEATURE_ADDR_SPACE_CAST is defined it expands to __attribute__((address_space(1))). In both cases bpftool generates the typed skel->arena accessor.

Fixes b986ae709b39 ("sched_ext: scx_qmap: move globals and cpu_ctx into a BPF arena map")
---
 tools/sched_ext/scx_qmap.bpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/sched_ext/scx_qmap.bpf.c +1 -1
index bea43d235908..7e77f22674ea 100644
@@ -89,7 +89,7 @@ struct {
 #endif
 } arena SEC(".maps");
 
-struct qmap_arena __arena qa;
+struct qmap_arena __arena_global qa;
 
 /*
  * Global idle-cid tracking, maintained via update_idle / cpu_offline and
Signature · 1 line
2.43.0
reviewer
#1 lore raw

Hello,

Quoted 1 line · Cheng-Yang Chou

tools/sched_ext: scx_qmap: Fix qa arena placement

Applied to sched_ext/for-7.2 with the Fixes: SHA replaced by 60a59eaca71b ("sched_ext: scx_qmap: move globals and cpu_ctx into a BPF arena map"). The b986ae709b39 you referenced is a local-only commit on one of my work branches; the corresponding public commit on for-7.2 is 60a59eaca71b. The arena conversion isn't on for-7.1-fixes, so the fix lands on for-7.2 along with it.

Thanks.

--
tejun