[PATCH 1/4] tools/sched_ext: compat.bpf.h: fix scx_bpf_dsq_reenq___compat signature

zhidao su posted 4 patches 6 days, 22 hours ago
[PATCH 1/4] tools/sched_ext: compat.bpf.h: fix scx_bpf_dsq_reenq___compat signature
Posted by zhidao su 6 days, 22 hours ago
scx_bpf_dsq_reenq() is declared with KF_IMPLICIT_ARGS in the kernel BTF,
which means the BPF verifier automatically injects the
struct bpf_prog_aux *aux parameter.  The BPF-side weak symbol declaration
must NOT include the implicit parameter.

The previous declaration included an explicit aux__prog parameter, which
caused BPF programs calling scx_bpf_dsq_reenq() through the compat macro
to fail verification on kernels where the kfunc is available.

Fix the declaration to match the calling convention expected by the
verifier (2 parameters: dsq_id and reenq_flags).

Fixes: c50dcf533149 ("selftests/sched_ext: Add tests for SCX_ENQ_IMMED and scx_bpf_dsq_reenq()")
Signed-off-by: zhidao su <suzhidao@xiaomi.com>
---
 tools/sched_ext/include/scx/compat.bpf.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/sched_ext/include/scx/compat.bpf.h b/tools/sched_ext/include/scx/compat.bpf.h
index 654b566bd94a..6fbacc909b8b 100644
--- a/tools/sched_ext/include/scx/compat.bpf.h
+++ b/tools/sched_ext/include/scx/compat.bpf.h
@@ -405,7 +405,7 @@ static inline void scx_bpf_reenqueue_local(void)
  * v6.20: New scx_bpf_dsq_reenq() that allows re-enqueues on more DSQs. This
  * will eventually deprecate scx_bpf_reenqueue_local().
  */
-void scx_bpf_dsq_reenq___compat(u64 dsq_id, u64 reenq_flags, const struct bpf_prog_aux *aux__prog) __ksym __weak;
+void scx_bpf_dsq_reenq___compat(u64 dsq_id, u64 reenq_flags) __ksym __weak;
 
 static inline bool __COMPAT_has_generic_reenq(void)
 {
@@ -415,7 +415,7 @@ static inline bool __COMPAT_has_generic_reenq(void)
 static inline void scx_bpf_dsq_reenq(u64 dsq_id, u64 reenq_flags)
 {
 	if (bpf_ksym_exists(scx_bpf_dsq_reenq___compat))
-		scx_bpf_dsq_reenq___compat(dsq_id, reenq_flags, NULL);
+		scx_bpf_dsq_reenq___compat(dsq_id, reenq_flags);
 	else if (dsq_id == SCX_DSQ_LOCAL && reenq_flags == 0)
 		scx_bpf_reenqueue_local();
 	else
-- 
2.43.0
Re: [PATCH 1/4] tools/sched_ext: compat.bpf.h: fix scx_bpf_dsq_reenq___compat signature
Posted by Tejun Heo 6 days, 18 hours ago
On Fri, Mar 27, 2026 at 04:42:35AM +0800, zhidao su wrote:
> scx_bpf_dsq_reenq() is declared with KF_IMPLICIT_ARGS in the kernel BTF,
> which means the BPF verifier automatically injects the
> struct bpf_prog_aux *aux parameter.  The BPF-side weak symbol declaration
> must NOT include the implicit parameter.
> 
> The previous declaration included an explicit aux__prog parameter, which
> caused BPF programs calling scx_bpf_dsq_reenq() through the compat macro
> to fail verification on kernels where the kfunc is available.

Did this actually cause verification failure tho? If BPF isn't ignoring the
implicit arg, it should have just failed ksym_exists test and then fell back
to the older interface or trigger scx_bpf_error().

It's rather obvious that most of your patches are AI slob and I don't see
much value in the selftests that you added either. I'll just revert your
previous patches. Please carefully consider whether what you're sending
actually contributes anything practical and carefully verify the code
changes and description before sending them. These frivolous and plausible
sounding but not actually correct patches are taking bandwidth without
actually improving anything. I'll likely ignore your submissions from now on
unless the trajectory changes substantially.

Thanks.

-- 
tejun