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 10/11] sched_ext: scx_qmap: Add proxy execution support
Date: Wed, 15 Jul 2026 21:35:27 +0000	[thread overview]
Message-ID: <20260715213527.93DB31F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260715205622.276220-11-arighi@nvidia.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Infinite re-enqueue loop (hard lockup) for blocked tasks when CPU capability is revoked.
--

--- Patch [10]: [PATCH 10/11] sched_ext: scx_qmap: Add proxy execution support ---
commit 330898ee3998dc8e218d6fe5b7b813cf89e4a38d
Author: Andrea Righi <arighi@nvidia.com>

sched_ext: scx_qmap: Add proxy execution support
    
Add a -B option to opt scx_qmap into queueing mutex-blocked tasks for
proxy execution. Blocked donors are dispatched directly to the local DSQ 
of their current cid with a fresh slice and SCX_ENQ_PREEMPT.

> diff --git a/tools/sched_ext/scx_qmap.bpf.c b/tools/sched_ext/scx_qmap.bpf.c
> index 09aee49120c28..dd308d1c89e2e 100644
> --- a/tools/sched_ext/scx_qmap.bpf.c
> +++ b/tools/sched_ext/scx_qmap.bpf.c

[ ... ]

> @@ -451,6 +451,22 @@ void BPF_STRUCT_OPS(qmap_enqueue, struct task_struct *p, u64 enq_flags)
>  	 */
>  	taskc->core_sched_seq = qa.core_sched_tail_seqs[idx]++;
>  
> +	/*
> +	 * Insert a blocked mutex donor at the head of its current cid's local
> +	 * DSQ with a fresh slice and %SCX_ENQ_PREEMPT, requesting an immediate
> +	 * reschedule. Once selected, the core proxy-exec path can immediately
> +	 * run the mutex owner using the donor's scheduling context.
> +	 *
> +	 * This policy is intentionally unfair and can strongly prioritize tasks
> +	 * using contended mutexes; scx_qmap is a demonstration scheduler and
> +	 * this behavior makes proxy-exec support easy to observe.
> +	 */
> +	if (enq_flags & SCX_ENQ_BLOCKED) {
> +		scx_bpf_dsq_insert(p, SCX_DSQ_LOCAL_ON | scx_bpf_task_cid(p),
> +				   slice_ns, enq_flags | SCX_ENQ_PREEMPT);
> +		return;
> +	}

[Severity: High]
Can this cause a hard lockup if a sub-scheduler dynamically loses CPU
capability?

When a sub-scheduler is used (via the -c option) and loses capability on the
task's current CPU, the kernel routes the task to the reject DSQ and
re-enqueues it with the SCX_ENQ_REENQ flag.

Since this check unconditionally handles SCX_ENQ_BLOCKED and returns early,
won't it bypass the SCX_ENQ_REENQ fallback logic later in qmap_enqueue
that normally routes rejected tasks to SHARED_DSQ?

If the sub-scheduler still lacks capability, the kernel will reject it
again. Because balance_scx() processes the reject DSQ synchronously until
empty, won't this create an infinite re-enqueue loop?

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

  reply	other threads:[~2026-07-15 21:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-15 20:54 [PATCHSET v6 sched_ext/for-7.3] sched: Make proxy execution compatible with sched_ext Andrea Righi
2026-07-15 20:54 ` [PATCH 01/11] sched: Make NOHZ CFS bandwidth checks follow proxy donor Andrea Righi
2026-07-15 20:54 ` [PATCH 02/11] sched: Add helper to block retained proxy donors Andrea Righi
2026-07-15 20:54 ` [PATCH 03/11] sched_ext: Block proxy donors across scheduler transitions Andrea Righi
2026-07-15 20:54 ` [PATCH 04/11] sched_ext: Fix ops.running/stopping() pairing for proxy-exec donors Andrea Righi
2026-07-15 20:54 ` [PATCH 05/11] sched_ext: Fix TOCTOU race in consume_remote_task() Andrea Righi
2026-07-15 21:14   ` sashiko-bot
2026-07-15 20:54 ` [PATCH 06/11] sched_ext: Split curr|donor references properly Andrea Righi
2026-07-15 21:15   ` sashiko-bot
2026-07-15 20:54 ` [PATCH 07/11] sched_ext: Handle blocked donor migration with proxy execution Andrea Righi
2026-07-15 21:21   ` sashiko-bot
2026-07-15 20:54 ` [PATCH 08/11] sched_ext: Delegate proxy donor admission to BPF schedulers Andrea Righi
2026-07-15 20:54 ` [PATCH 09/11] sched_ext: Add selftest for blocked donor admission Andrea Righi
2026-07-15 20:54 ` [PATCH 10/11] sched_ext: scx_qmap: Add proxy execution support Andrea Righi
2026-07-15 21:35   ` sashiko-bot [this message]
2026-07-15 20:54 ` [PATCH 11/11] sched: Allow enabling proxy exec with sched_ext 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=20260715213527.93DB31F000E9@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