[PATCHSET sched_ext/for-7.0-fixes] sched_ext: Fix SCX_KICK_WAIT deadlock

Tejun Heo
2026-03-29T00:18:57Z

Hello,

SCX_KICK_WAIT busy-waits in kick_cpus_irq_workfn() until the target CPU
reschedules. Because the irq_work runs in hardirq context, the waiting
CPU's kick_sync never advances, and if multiple CPUs form a wait cycle, all
deadlock. This was reported by Christian while testing on arm64.

0001 fixes the deadlock by deferring the wait to a balance callback which
drops the rq lock and enables IRQs, allowing IPIs to be processed and
kick_sync to keep advancing during the wait.

0002 adds a selftest that creates a 3-CPU kick_wait cycle to reproduce the
issue.

Based on sched_ext/for-7.0-fixes (db08b1940f4b).

0001-sched_ext-Fix-SCX_KICK_WAIT-deadlock-by-deferring-wa.patch
0002-selftests-sched_ext-Add-cyclic-SCX_KICK_WAIT-stress-.patch

kernel/sched/ext.c | 95 +++++++---
kernel/sched/sched.h | 3 +
tools/testing/selftests/sched_ext/Makefile | 1 +
.../selftests/sched_ext/cyclic_kick_wait.bpf.c | 68 ++++++++
.../testing/selftests/sched_ext/cyclic_kick_wait.c | 194 +++++++++++++++++++++
5 files changed, 336 insertions(+), 25 deletions(-)

--
tejun