Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [PATCH 0/2] sched_ext: Reset runnable_at when a task leaves its scheduler
@ 2026-10-19 12:41 Michal Blaszczyk
  2026-10-19 12:41 ` [PATCH 1/2] " Michal Blaszczyk
  2026-10-19 12:41 ` [PATCH 2/2] selftests/sched_ext: Add class_switch_stall test Michal Blaszczyk
  0 siblings, 2 replies; 6+ messages in thread
From: Michal Blaszczyk @ 2026-10-19 12:41 UTC (permalink / raw)
  To: Tejun Heo, David Vernet, Andrea Righi, Changwoo Min
  Cc: sched-ext, linux-kernel, linux-kselftest, Kuba Piecuch,
	Michal Blaszczyk

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-10-19 22:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-19 12:41 [PATCH 0/2] sched_ext: Reset runnable_at when a task leaves its scheduler Michal Blaszczyk
2026-10-19 12:41 ` [PATCH 1/2] " Michal Blaszczyk
2026-10-19 13:51   ` Andrea Righi
2026-10-19 22:58   ` Tejun Heo
2026-10-19 12:41 ` [PATCH 2/2] selftests/sched_ext: Add class_switch_stall test Michal Blaszczyk
2026-10-19 13:54   ` Andrea Righi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox