A task that is switched out of SCHED_EXT while it's waiting keeps its p->scx.runnable_at. When it comes back, the watchdog counts the time it spent in another class as waiting, and can abort the scheduler for a stall that didn't happen. Patch 1 restarts the wait when a task leaves its scheduler. Patch 2 adds a selftest that reproduces the spurious stall.
The bug goes back to the watchdog's introduction in v6.12. The series is based on sched_ext/for-7.4, and patch 1 also applies to for-7.3-fixes. Tested in a virtme-ng VM (16 CPUs, PROVE_LOCKING): class_switch_stall fails every time without patch 1 and passes with it. The other sched_ext selftests give the same results with and without the series (enq_blocked fails in this VM either way). I used an AI coding assistant to find the bug and to write and test both patches. Michal Blaszczyk (2): sched_ext: Reset runnable_at when a task leaves its scheduler selftests/sched_ext: Add class_switch_stall test kernel/sched/ext/ext.c | 14 +- tools/testing/selftests/sched_ext/Makefile | 1 + .../sched_ext/class_switch_stall.bpf.c | 121 +++++++++ .../selftests/sched_ext/class_switch_stall.c | 240 ++++++++++++++++++ 4 files changed, 375 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/sched_ext/class_switch_stall.bpf.c create mode 100644 tools/testing/selftests/sched_ext/class_switch_stall.c base-commit: 1f5dde349ac2fca1f119ae8de3f0d2f1c2a8d338 -- 2.56.0.176.g3575e65682-goog

