(I'm so sorry!) Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

selftests/sched_ext: Fail loudly when EXIT_KIND is missing from BTF

EXIT_KIND() resolved scx_exit_kind values through __COMPAT_ENUM_OR_ZERO(), which maps a missing enumerator to 0 (== SCX_EXIT_NONE). struct scx_exit_info carries the enum itself, so the BTF of any loaded scheduler always has the type, and every enumerator the tests resolve today exists on all sched_ext kernels: the fallback got the value right, and the single comparison that could pass vacuously was the kick.c error poll. Still, a silently-zeroed lookup is a trap. EXIT_KIND() is now an alias of SCX_KIND_VAL(), which fails the test loudly when the enumerator is missing. Convert the remaining `kind != EXIT_KIND(SCX_EXIT_NONE)` checks (allowed_cpus, cgroup_nr_cpus, cyclic_kick_wait and enq_blocked) to UEI_EXITED() so they keep their semantics without a BTF lookup, and hoist kick.c invalid_one()'s error_kind resolution above the gated-worker spawn so a failing lookup cannot bypass its cleanup path. Signed-off-by: Tao Cui <cuitao@kylinos.cn> Signed-off-by: Tejun Heo <tj@kernel.org>


Author Tao Cui Committer Tejun Heo Date Commit Parent 883c9e81
+28 -16
7 changed files
+28 -16
7 changed files