diff options
| author | Andrea Righi <arighi@nvidia.com> | 2025-02-27 10:11:38 +0100 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2025-02-27 06:26:58 -1000 |
| commit | b214b04df9c8dc7ff7647c0e185cee01baea8451 (patch) | |
| tree | 3b3c438216884eed44916242d5e48f64b835f3e7 /tools/sched_ext/include | |
| parent | 5ae5161820e5c21e85a905a1f47e8f28e5042bf5 (diff) | |
| download | lwn-b214b04df9c8dc7ff7647c0e185cee01baea8451.tar.gz lwn-b214b04df9c8dc7ff7647c0e185cee01baea8451.zip | |
tools/sched_ext: Provide a compatible helper for scx_bpf_events()
Introduce __COMPAT_scx_bpf_events() to use scx_bpf_events() in a
compatible way also with kernels that don't provide this kfunc.
This also fixes the following error with scx_qmap when running on a
kernel that does not provide scx_bpf_events():
; scx_bpf_events(&events, sizeof(events)); @ scx_qmap.bpf.c:777
318: (b7) r2 = 72 ; R2_w=72 async_cb
319: <invalid kfunc call>
kfunc 'scx_bpf_events' is referenced but wasn't resolved
Fixes: 9865f31d852a4 ("sched_ext: Add scx_bpf_events() and scx_read_event() for BPF schedulers")
Signed-off-by: Andrea Righi <arighi@nvidia.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'tools/sched_ext/include')
| -rw-r--r-- | tools/sched_ext/include/scx/compat.bpf.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/sched_ext/include/scx/compat.bpf.h b/tools/sched_ext/include/scx/compat.bpf.h index 266f94fe479b..9252e1a00556 100644 --- a/tools/sched_ext/include/scx/compat.bpf.h +++ b/tools/sched_ext/include/scx/compat.bpf.h @@ -183,7 +183,15 @@ static inline bool __COMPAT_is_enq_cpu_selected(u64 enq_flags) bpf_ktime_get_ns()) /* + * v6.15: Introduce event counters. * + * Preserve the following macro until v6.17. + */ +#define __COMPAT_scx_bpf_events(events, size) \ + (bpf_ksym_exists(scx_bpf_events) ? \ + scx_bpf_events(events, size) : ({})) + +/* * v6.15: Introduce NUMA-aware kfuncs to operate with per-node idle * cpumasks. * |
