Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sched_ext: Add ___compat suffix to scx_bpf_dsq_insert___v2 in compat.bpf.h

2dbbdeda77a6 ("sched_ext: Fix scx_bpf_dsq_insert() backward binary
compatibility") renamed the new bool-returning variant to scx_bpf_dsq_insert___v2
in the kernel. However, libbpf currently only strips ___SUFFIX on the BPF side,
not on kernel symbols, so the compat wrapper couldn't match the kernel kfunc and
would always fall back to the old variant even when the new one was available.

Add an extra ___compat suffix as a workaround - libbpf strips one suffix on the
BPF side leaving ___v2, which then matches the kernel kfunc directly. In the
future when libbpf strips all suffixes on both sides, all suffixes can be
dropped.

Fixes: 2dbbdeda77a6 ("sched_ext: Fix scx_bpf_dsq_insert() backward binary compatibility")
Cc: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Tejun Heo <tj@kernel.org>

Tejun Heo dcb938c4 71d7847c

+5 -3
+5 -3
tools/sched_ext/include/scx/compat.bpf.h
··· 237 237 /* 238 238 * v6.19: scx_bpf_dsq_insert() now returns bool instead of void. Move 239 239 * scx_bpf_dsq_insert() decl to common.bpf.h and drop compat helper after v6.22. 240 + * The extra ___compat suffix is to work around libbpf not ignoring __SUFFIX on 241 + * kernel side. The entire suffix can be dropped later. 240 242 */ 241 - bool scx_bpf_dsq_insert___v2(struct task_struct *p, u64 dsq_id, u64 slice, u64 enq_flags) __ksym __weak; 243 + bool scx_bpf_dsq_insert___v2___compat(struct task_struct *p, u64 dsq_id, u64 slice, u64 enq_flags) __ksym __weak; 242 244 void scx_bpf_dsq_insert___v1(struct task_struct *p, u64 dsq_id, u64 slice, u64 enq_flags) __ksym __weak; 243 245 244 246 static inline bool 245 247 scx_bpf_dsq_insert(struct task_struct *p, u64 dsq_id, u64 slice, u64 enq_flags) 246 248 { 247 - if (bpf_ksym_exists(scx_bpf_dsq_insert___v2)) { 248 - return scx_bpf_dsq_insert___v2(p, dsq_id, slice, enq_flags); 249 + if (bpf_ksym_exists(scx_bpf_dsq_insert___v2___compat)) { 250 + return scx_bpf_dsq_insert___v2___compat(p, dsq_id, slice, enq_flags); 249 251 } else { 250 252 scx_bpf_dsq_insert___v1(p, dsq_id, slice, enq_flags); 251 253 return true;