mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michal Blaszczyk <michalblk@google.com>
To: Tejun Heo <tj@kernel.org>, David Vernet <void@manifault.com>,
	Andrea Righi <arighi@nvidia.com>,
	 Changwoo Min <changwoo@igalia.com>
Cc: sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org,
	 linux-kselftest@vger.kernel.org,
	Kuba Piecuch <jpiecuch@google.com>,
	 Michal Blaszczyk <michalblk@google.com>
Subject: [PATCH 0/2] sched_ext: Reset runnable_at when a task leaves its scheduler
Date: Mon, 19 Oct 2026 12:41:44 +0000	[thread overview]
Message-ID: <20261019124146.3582127-1-michalblk@google.com> (raw)

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


             reply	other threads:[~2026-10-19 12:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19 12:41 Michal Blaszczyk [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261019124146.3582127-1-michalblk@google.com \
    --to=michalblk@google.com \
    --cc=arighi@nvidia.com \
    --cc=changwoo@igalia.com \
    --cc=jpiecuch@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=sched-ext@lists.linux.dev \
    --cc=tj@kernel.org \
    --cc=void@manifault.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®