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 07/10] sched_ext: Delegate proxy donor admission to BPF schedulers
Date: Mon, 13 Jul 2026 16:45:19 +0000	[thread overview]
Message-ID: <20260713164519.AD2821F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260713162112.26785-8-arighi@nvidia.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Blocked proxy donors can bypass admission checks and transition into ext_sched_class while remaining queued during PI de-boost.
--

--- Patch [7]: [PATCH 07/10] sched_ext: Delegate proxy donor admission to BPF schedulers ---
commit 1b08b364547eb25f8929e3f17ff8248b2a3685d6
Author: Andrea Righi <arighi@nvidia.com>

    sched_ext: Delegate proxy donor admission to BPF schedulers
    
    Proxy execution keeps a blocked donor runnable so its scheduling context
    can execute the mutex owner. Dispatching sched_ext donors on a local
    DSQ bypasses the BPF scheduler ordering policy and can give donors
    more CPU priority than intended to perform the proxy execution handoff.

> diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c
> index 1f05f91e55192..6418b4d478e40 100644
> --- a/kernel/sched/ext/ext.c
> +++ b/kernel/sched/ext/ext.c

[ ... ]

> @@ -2887,18 +2949,12 @@ static void put_prev_task_scx(struct rq *rq, struct task_struct *p,
>  		set_task_runnable(rq, p);
>  
>  		/*
> -		 * Mutex-blocked donors stay queued on the runqueue under proxy
> -		 * execution, but the donor never runs as itself, proxy-exec
> -		 * walks the blocked_on chain on the next __schedule() and runs
> -		 * the lock owner in its place.
> -		 *
> -		 * Put the donor on the local DSQ directly so pick_next_task()
> -		 * can still see it. find_proxy_task() will either run the chain
> -		 * owner or deactivate the donor so the wakeup path can return it
> -		 * and let BPF make a new dispatch decision once it is unblocked.
> +		 * Mutex-blocked donors only stay queued when their BPF scheduler
> +		 * enables %SCX_OPS_ENQ_BLOCKED, so always delegate their admission.
>  		 */
>  		if (p->is_blocked) {
> -			scx_dispatch_enqueue(sch, rq, &rq->scx.local_dsq, p, 0);
> +			WARN_ON_ONCE(!(sch->ops.flags & SCX_OPS_ENQ_BLOCKED));

[Severity: High]
Can a blocked proxy donor bypass admission checks and transition into
ext_sched_class while remaining queued during a PI de-boost?

If a task whose normal policy is SCHED_EXT acquires a mutex and is boosted
to RT priority via rt_mutex_setprio() (because a higher-priority RT task
blocked on it), it might subsequently block on a second mutex, becoming a
blocked donor.

When the higher-priority task gives up the first mutex or is killed, the
donor is de-boosted. In rt_mutex_setprio(), the task's policy is set back
to SCHED_EXT:

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) {
    ...
}

Because this doesn't invoke scx_prepare_setscheduler() or
sched_proxy_block_task(), wouldn't the blocked task remain queued on the
runqueue? This could pass the blocked task to a BPF scheduler that does
not have SCX_OPS_ENQ_BLOCKED enabled, triggering this WARN_ON_ONCE.

> +			scx_do_enqueue_task(rq, p, 0, -1);
>  			goto switch_class;
>  		}
>

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

  reply	other threads:[~2026-07-13 16:45 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
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 [this message]
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=20260713164519.AD2821F000E9@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