From: K Prateek Nayak <kprateek.nayak@amd.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Clark Williams <clrkwllms@kernel.org>,
<linux-kernel@vger.kernel.org>, <linux-rt-devel@lists.linux.dev>,
"Dietmar Eggemann" <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
"Valentin Schneider" <vschneid@redhat.com>,
Tejun Heo <tj@kernel.org>,
"Gautham R. Shenoy" <gautham.shenoy@amd.com>
Subject: Re: [RFC PATCH] sched/core: Stash task priority after dequeue and put_prev_task() in sched_change_begin()
Date: Wed, 7 Jan 2026 11:01:11 +0530 [thread overview]
Message-ID: <693c35a3-a83c-4ed8-ad5d-5ff4ab7b40c6@amd.com> (raw)
In-Reply-To: <20260106104113.GX3707891@noisy.programming.kicks-ass.net>
Hello Peter,
On 1/6/2026 4:11 PM, Peter Zijlstra wrote:
> On Tue, Jan 06, 2026 at 07:52:39AM +0000, K Prateek Nayak wrote:
>> When running amd-pstate driver on a PREEMPT_RT kernel on a shared memory
>> system (Zen3 and prior), the following splat was observed from
>> triggering the WARN_ON_ONCE() in rq_pin_lock():
>>
>> ------------[ cut here ]------------
>> WARNING: kernel/sched/sched.h:1807 at __schedule+0x122/0x17c0, CPU#8: swapper/0/1
>
> Can you enable CONFIG_DEBUG_BUGVERBOSE_DETAILED?
Ack! I didn't know this was the config that printed the condition for
the warn on. I'll make sure to enable it henceforth.
[..snip..]
>> Since the dequeue on a deadline task can push its deadline, stash the
>> task prio towards the end of sched_change_begin().
>>
>> The modification to priority within the sched_change guard's scope will
>> still be considered as sched_change_end() will supply the priority
>> stashed at the end of constructor's execution as the old priority to
>> sched_class->prio_changed().
>>
>
> Would not something like so make more sense?
>
> ---
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index 80c9559a3e30..60e0c25aae78 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -3306,6 +3306,8 @@ static void switched_to_dl(struct rq *rq, struct task_struct *p)
>
> static u64 get_prio_dl(struct rq *rq, struct task_struct *p)
> {
> + if (task_current_donor(rq, p))
> + update_curr_dl(rq);
> return p->dl.deadline;
> }
>
Yup this makes sense too! Feel free to add a small note like:
Catch up the deadline before returning it from get_prio() for the
current donor. This ensures the sched_change guard caches the latest
value and doesn't mistake the subsequent dequeue to have changed the
task's priority.
and include:
Reviewed-and-tested-by: K Prateek Nayak <kprateek.nayak@amd.com>
--
Thanks and Regards,
Prateek
next prev parent reply other threads:[~2026-01-07 5:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-06 7:52 K Prateek Nayak
2026-01-06 10:41 ` Peter Zijlstra
2026-01-07 5:31 ` K Prateek Nayak [this message]
2026-01-15 21:01 ` [tip: sched/urgent] sched/deadline: Ensure get_prio_dl() is up-to-date tip-bot2 for Peter Zijlstra
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=693c35a3-a83c-4ed8-ad5d-5ff4ab7b40c6@amd.com \
--to=kprateek.nayak@amd.com \
--cc=bigeasy@linutronix.de \
--cc=bsegall@google.com \
--cc=clrkwllms@kernel.org \
--cc=dietmar.eggemann@arm.com \
--cc=gautham.shenoy@amd.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tj@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.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®