Sched_ext development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Andrea Righi" <arighi@nvidia.com>
Cc: sched-ext@lists.linux.dev
Subject: Re: [PATCH 02/10] sched_ext: Block proxy donors across scheduler transitions
Date: Mon, 13 Jul 2026 16:41:31 +0000	[thread overview]
Message-ID: <20260713164131.906F41F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260713162112.26785-3-arighi@nvidia.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] sched_ext activation and PI de-boosting bypass scx_prepare_setscheduler(), leaking retained proxy donors into the BPF scheduler.
--

--- Patch [2]: [PATCH 02/10] sched_ext: Block proxy donors across scheduler transitions ---
commit 824f6d5806618a51db9777883b9153164c747f32
Author: Andrea Righi <arighi@nvidia.com>

sched_ext: Block proxy donors across scheduler transitions

This patch makes sched_ext reject retained proxy donors by default. It forces
blocked tasks through the regular block path in schedule() and fully
deactivates a retained donor before sched_setscheduler() moves it into the
EXT class.

[ ... ]

> diff --git a/kernel/sched/syscalls.c b/kernel/sched/syscalls.c
> index b215b0ead9a60..2bbba3dc8c890 100644
> --- a/kernel/sched/syscalls.c
> +++ b/kernel/sched/syscalls.c
> @@ -678,6 +678,9 @@ int __sched_setscheduler(struct task_struct *p,
>  	if (prev_class != next_class)
>  		queue_flags |= DEQUEUE_CLASS;
>  
> +	if (!(attr->sched_flags & SCHED_FLAG_KEEP_PARAMS))
> +		scx_prepare_setscheduler(p, next_class);
> +

[Severity: High]
Can retained proxy donors leak into the ext_sched_class without the BPF
scheduler opting in during global activation or PI de-boosting?

Looking at scx_root_enable_workfn() in kernel/sched/ext/ext.c, tasks
transition to ext_sched_class without invoking scx_prepare_setscheduler():

kernel/sched/ext/ext.c:scx_root_enable_workfn() {
...
		if (old_class != new_class)
			queue_flags |= DEQUEUE_CLASS;

		scoped_guard (sched_change, p, queue_flags) {
			p->scx.slice = READ_ONCE(sch->slice_dfl);
			p->sched_class = new_class;
		}
...
}

A similar transition occurs during PI de-boosting:

kernel/sched/core.c:rt_mutex_setprio() {
...
	prev_class = p->sched_class;
	next_class = __setscheduler_class(p->policy, prio);

	if (prev_class != next_class)
		queue_flag |= DEQUEUE_CLASS;

	scoped_guard (sched_change, p, queue_flag) {
...
}

If a task is blocked on a mutex and retained as a proxy donor, would missing
this check cause the task to bypass the blocking logic? Could this cause
runqueue corruption when the BPF scheduler receives a blocked task it assumes
is runnable?

>  	scoped_guard (sched_change, p, queue_flags) {
>  
>  		if (!(attr->sched_flags & SCHED_FLAG_KEEP_PARAMS)) {

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260713162112.26785-1-arighi@nvidia.com?part=2

  reply	other threads:[~2026-07-13 16:41 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-13 16:17 [PATCHSET v5 sched_ext/for-7.3] sched: Make proxy execution compatible with sched_ext Andrea Righi
2026-07-13 16:17 ` [PATCH 01/10] sched: Add helper to block retained proxy donors Andrea Righi
2026-07-13 16:17 ` [PATCH 02/10] sched_ext: Block proxy donors across scheduler transitions Andrea Righi
2026-07-13 16:41   ` sashiko-bot [this message]
2026-07-13 16:17 ` [PATCH 03/10] sched_ext: Fix ops.running/stopping() pairing for proxy-exec donors Andrea Righi
2026-07-13 16:17 ` [PATCH 04/10] sched_ext: Split curr|donor references properly Andrea Righi
2026-07-13 16:48   ` sashiko-bot
2026-07-13 16:17 ` [PATCH 05/10] sched_ext: Fix TOCTOU race in consume_remote_task() Andrea Righi
2026-07-13 16:17 ` [PATCH 06/10] sched_ext: Handle blocked donor migration with proxy execution Andrea Righi
2026-07-13 16:44   ` sashiko-bot
2026-07-13 16:17 ` [PATCH 07/10] sched_ext: Delegate proxy donor admission to BPF schedulers Andrea Righi
2026-07-13 16:45   ` sashiko-bot
2026-07-13 16:17 ` [PATCH 08/10] sched_ext: Add selftest for blocked donor admission Andrea Righi
2026-07-13 16:34   ` sashiko-bot
2026-07-13 16:17 ` [PATCH 09/10] sched_ext: scx_qmap: Add proxy execution support Andrea Righi
2026-07-13 16:17 ` [PATCH 10/10] sched: Allow enabling proxy exec with sched_ext Andrea Righi
2026-07-13 16:49   ` sashiko-bot

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=20260713164131.906F41F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=arighi@nvidia.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=sched-ext@lists.linux.dev \
    /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