Re: [PATCH bpf-next v2 2/6] sched_ext: Prefer ___v2 kfunc names in compat.bpf.h

From: bot+bpf-ci

Date: Fri Nov 20 2026 - 20:14:10 EST


> sched_ext: Prefer ___v2 kfunc names in compat.bpf.h

TL;DR: __COMPAT_scx_bpf_reenqueue_local_from_anywhere() in compat.bpf.h still
checks only the ___v2___compat name, so with the new libbpf it may return
false on v6.19+ kernels, silently disabling scx_qmap's sched_switch reenqueue.

> diff --git a/tools/sched_ext/include/scx/compat.bpf.h b/tools/sched_ext/include/scx/compat.bpf.h
> --- a/tools/sched_ext/include/scx/compat.bpf.h
> +++ b/tools/sched_ext/include/scx/compat.bpf.h

[ ... ]

> u32 scx_bpf_reenqueue_local___v1(void) __ksym __weak;
> +void scx_bpf_reenqueue_local___v2(void) __ksym __weak;
> void scx_bpf_reenqueue_local___v2___compat(void) __ksym __weak;
>
> static inline bool __COMPAT_scx_bpf_reenqueue_local_from_anywhere(void)
> {
> return bpf_ksym_exists(scx_bpf_reenqueue_local___v2___compat);
> }

After the libbpf change described in the commit message, the
___v2___compat names resolve nothing. This predicate still tests only
scx_bpf_reenqueue_local___v2___compat, so with that libbpf it would
return false even on v6.19+ kernels where
scx_bpf_reenqueue_local___v2() can be called from anywhere.

The in-tree wrappers scx_bpf_reenqueue_local() and
scx_bpf_reenqueue_local_from_anywhere() check
bpf_ksym_exists(scx_bpf_reenqueue_local___v2) before calling it, but
__COMPAT_scx_bpf_reenqueue_local_from_anywhere() is exported from this
header and schedulers use it directly. For example, scx_qmap does:

qmap_sched_switch():
if (!__COMPAT_scx_bpf_reenqueue_local_from_anywhere())
return 0;
qmap_cpu_release():
if (!__COMPAT_scx_bpf_reenqueue_local_from_anywhere())
scx_bpf_reenqueue_local();

A scheduler built this way would silently turn off its sched_switch based
reenqueue and fall back to ops.cpu_release().

Should this predicate also check scx_bpf_reenqueue_local___v2, so that it
still returns true on v6.19+ kernels with the new libbpf? Note that the
two ksym checks probably need to be in separate branches rather than an
||, since the comment in scx_bpf_reenqueue_local_from_anywhere() says
clang can fold that into a bitwise OR of the ksym addresses.


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/44845964556