selftests/sched_ext: Add class_switch_stall test
Subsystems (2)
PATCH v2 1/1 selftests/sched_ext: Add class_switch_stall test
Add a test for a task which leaves SCHED_EXT while it's waiting. Its scheduler keeps the task waiting on a DSQ after it wakes up. The test switches the task to SCHED_OTHER while it's waiting, lets it sleep outside of SCHED_EXT for longer than the watchdog timeout, then switches it back and wakes it up. The scheduler keeps it waiting again, for longer than the watchdog interval but shorter than the timeout, which the watchdog must not report as a stall.
Without commit 993e8fbfecbb ("sched_ext: Reset runnable_at when a task leaves its scheduler"), the watchdog charges the task for the time it spent outside of SCHED_EXT and aborts the scheduler.
---
Notes:
v2: Raise the watchdog timeout to 3s and the park time to 2s, set timeout_ms from userspace, shorten the time outside of SCHED_EXT to TIMEOUT_MS + 1s, and derive the second read timeout from TIMEOUT_MS (Andrea). Rebase on sched_ext/for-7.4-fixes, which has the fix this tests, and refer to the fix by its commit ID.
v1: https://lore.kernel.org/r/[email protected]
tools/testing/selftests/sched_ext/Makefile | 1 + .../sched_ext/class_switch_stall.bpf.c | 120 +++++++++ .../selftests/sched_ext/class_switch_stall.c | 245 ++++++++++++++++++ 3 files changed, 366 insertions(+) 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
tools/testing/selftests/sched_ext/Makefile +1 -0
@@ -165,6 +165,7 @@ all_test_bpfprogs := $(foreach prog,$(wildcard *.bpf.c),$(INCLUDE_DIR)/$(patsubs auto-test-targets := \ cgroup_nr_cpus \ + class_switch_stall \ create_dsq \ dequeue \ dequeue_iter \
tools/testing/selftests/sched_ext/class_switch_stall.bpf.c new file +120 -0
120 lines not on this page · raw message
tools/testing/selftests/sched_ext/class_switch_stall.c new file +245 -0
245 lines not on this page · raw message
base-commit: e2859566ffbc3a9f33308255114ccf167124e048
Signature · 1 line
2.56.0.212.g129ede20d9-goog
Applied to sched_ext/for-7.5.
Thanks.
--
tejun