All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/6] sched_ext: selftest infrastructure fixes
@ 2026-10-14 13:13 Tao Cui
  2026-10-14 13:13 ` [PATCH v2 1/6] selftests/sched_ext: Fix reload_loop error-path use-after-free Tao Cui
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Tao Cui @ 2026-10-14 13:13 UTC (permalink / raw)
  To: Tejun Heo
  Cc: David Vernet, Andrea Righi, Changwoo Min, sched-ext, Tao Cui,
	cui.tao

From: Tao Cui <cuitao@kylinos.cn>

The sched_ext selftests pass vacuously or hang in several failure
scenarios: a scheduler that dies mid-test freezes the state the test
asserts on, EXIT_KIND() silently maps missing BTF enumerators to
SCX_EXIT_NONE, waits for scheduler exit are unbounded, attach
failures in the reload stress test are swallowed, and an error path
in reload_loop destroys the skeleton under a still-running thread.

This is v2 of the series posted as [1]; it applies the review
feedback from Tejun (and the sashiko bot findings, which overlapped):

  - P1: use SCX_FAIL() inside the error branch.
  - P2: name ebeca1f930ea in the description (and fix the wrong
    attribution the v1 description carried).
  - P3: the v1 premise was wrong - struct scx_exit_info carries the
    enum, so the BTF always has the type and the enumerators the
    tests use exist on all sched_ext kernels. The patch is kept but
    reshaped: EXIT_KIND() is now an alias of SCX_KIND_VAL() (single
    implementation), the remaining kind != EXIT_KIND(SCX_EXIT_NONE)
    sites are converted to UEI_EXITED(), invalid_one() resolves
    error_kind before spawning the gated worker, and the v1
    <unistd.h> include is not needed here.
  - P4: SCX_ASSERT_ALIVE() prints uei.msg too.
  - P5: split in two. exit.c now destroys the link and the skeleton
    on its timeout path (a scheduler stuck unexited no longer stays
    attached and makes every later test fail with EBUSY); reload_loop
    drops its dead reporting arm and the always-on EBUSY printf, and
    the failure bar is now "at least one successful attach per
    thread". The two #defines became an enum and stray blank lines
    after setup() are gone.

Base: tj/sched_ext for-next at 8ef2c4fe917a ("Merge branch
'for-7.3-fixes' into for-next"), rebased after the review round.
v1 was based on the then-tip f55a5ae74ca6; the rebase is a pure
replay (the only selftest-side upstream change in between is a
dequeue_remote.c build fix outside the files touched here).

Testing: full sched_ext selftest suite (QEMU/KVM x86_64, 4 vcpus,
serial console) on a kernel built from this base: a runner built from
this series and a runner built from the plain base pass identically,
38 passed / 2 skipped / 0 failed each (the skips are
environment-dependent: enq_blocked requires PROXY_EXEC and nohz_tick
requires NOHZ_FULL; kick_coalesce passes since the base kernel has
lazy preemption). On top of that, A/B checks: a scheduler whose exit
point never fires wedges a pre-series runner forever in exit's
unbounded wait, while with patch 5 the runner reports "Timed out
waiting for scheduler to exit" after ~10s, destroys the link and the
skeleton, and every subsequent test still attaches and passes (the
stuck A/B ran on the f55a5ae74ca6 pre-rebase base with identical
series content; the remaining A/Bs were run the same way on the v1
base and their code paths are unchanged here); a synthetic BTF
without the SCX_EXIT_UNREG_BPF enumerator fails loudly with patch 3
and passes silently without it; an injected scheduler death reports
kind, exit code and uei.msg through SCX_ASSERT_ALIVE(); under reload
stress with in-flight teardown, patch 6 classifies the observed
1125-1233 EBUSY failures and passes as long as each thread completed
at least one attach.

[1] https://lore.kernel.org/all/20261009134104.296891-1-cui.tao@linux.dev/

Tao Cui (6):
  selftests/sched_ext: Fix reload_loop error-path use-after-free
  sched_ext: Add SCX_ECODE_RSN_CGROUP_OFFLINE to user_exit_info.h
  selftests/sched_ext: Fail loudly when EXIT_KIND is missing from BTF
  selftests/sched_ext: Add SCX_ASSERT_ALIVE and adopt it
  selftests/sched_ext: Bound exit waits
  selftests/sched_ext: Report reload_loop attach failures

 tools/sched_ext/include/scx/user_exit_info.h  |  1 +
 .../selftests/sched_ext/allowed_cpus.c        |  2 +-
 .../selftests/sched_ext/cgroup_nr_cpus.c      |  2 +-
 .../selftests/sched_ext/create_dsq.bpf.c      |  8 +++
 .../testing/selftests/sched_ext/create_dsq.c  |  2 +
 .../selftests/sched_ext/cyclic_kick_wait.c    |  2 +-
 .../testing/selftests/sched_ext/enq_blocked.c |  2 +-
 tools/testing/selftests/sched_ext/exit.c      |  8 ++-
 tools/testing/selftests/sched_ext/hotplug.c   | 12 ++--
 .../sched_ext/init_enable_count.bpf.c         |  8 +++
 .../selftests/sched_ext/init_enable_count.c   | 13 +++++
 tools/testing/selftests/sched_ext/kick.c      |  8 ++-
 .../testing/selftests/sched_ext/maximal.bpf.c |  6 +-
 tools/testing/selftests/sched_ext/maximal.c   |  2 +
 tools/testing/selftests/sched_ext/nohz_tick.c |  6 +-
 tools/testing/selftests/sched_ext/prog_run.c  |  7 ++-
 .../testing/selftests/sched_ext/reload_loop.c | 49 +++++++++++++---
 tools/testing/selftests/sched_ext/scx_test.h  | 57 +++++++++++++++++--
 18 files changed, 162 insertions(+), 33 deletions(-)

-- 
2.53.0


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

end of thread, other threads:[~2026-10-14 18:29 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-14 13:13 [PATCH v2 0/6] sched_ext: selftest infrastructure fixes Tao Cui
2026-10-14 13:13 ` [PATCH v2 1/6] selftests/sched_ext: Fix reload_loop error-path use-after-free Tao Cui
2026-10-14 13:13 ` [PATCH v2 2/6] sched_ext: Add SCX_ECODE_RSN_CGROUP_OFFLINE to user_exit_info.h Tao Cui
2026-10-14 13:13 ` [PATCH v2 3/6] selftests/sched_ext: Fail loudly when EXIT_KIND is missing from BTF Tao Cui
2026-10-14 13:28   ` sashiko-bot
2026-10-14 13:13 ` [PATCH v2 4/6] selftests/sched_ext: Add SCX_ASSERT_ALIVE and adopt it Tao Cui
2026-10-14 13:13 ` [PATCH v2 5/6] selftests/sched_ext: Bound exit waits Tao Cui
2026-10-14 13:13 ` [PATCH v2 6/6] selftests/sched_ext: Report reload_loop attach failures Tao Cui
2026-10-14 13:24   ` sashiko-bot
2026-10-14 18:29 ` [PATCH v2 0/6] sched_ext: selftest infrastructure fixes Tejun Heo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.