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 06/10] sched_ext: Handle blocked donor migration with proxy execution
Date: Mon, 13 Jul 2026 16:44:33 +0000	[thread overview]
Message-ID: <20260713164433.C93EE1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260713162112.26785-7-arighi@nvidia.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Unconditional enqueue of blocked proxy donors to the tail of the local DSQ causes priority inversion, escapes BPF scheduling quotas, and triggers kernel warnings.
--

--- Patch [6]: [PATCH 06/10] sched_ext: Handle blocked donor migration with proxy execution ---
commit dce762461a67fc44d618711fc879bc542af59027
Author: John Stultz <jstultz@google.com>

sched_ext: Handle blocked donor migration with proxy execution

This commit enables sched_ext to handle the migration of blocked donors
under proxy execution. It allows normal migration of non-active blocked
donors and ensures they remain on the local DSQ when put, maintaining
visibility for the proxy pick path.

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

[ ... ]

> @@ -2873,6 +2886,22 @@ static void put_prev_task_scx(struct rq *rq, struct task_struct *p,
>  	if (p->scx.flags & SCX_TASK_QUEUED) {
>  		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.
> +		 */
> +		if (p->is_blocked) {
> +			scx_dispatch_enqueue(sch, rq, &rq->scx.local_dsq, p, 0);

[Severity: High]
By unconditionally passing 0 (tail enqueue) to scx_dispatch_enqueue() for
preempted proxy donors, does this cause a priority inversion by defeating
proxy execution priority inheritance?

Furthermore, if a donor task exhausts its slice and is preempted here, does
this bypass the do_enqueue_task() fallback path? It seems zero-slice donors
would get trapped in the local DSQ instead of returning to the BPF
scheduler via ops.enqueue(), potentially triggering a kernel warning in
do_pick_task_scx() and artificially granting an unmonitored slice_dfl refill
that bypasses BPF quotas.

> +			goto switch_class;
> +		}
> +
>  		/*
>  		 * If @p has slice left and is being put, @p is getting
>  		 * preempted by a higher priority scheduler class or core-sched

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

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