From: Peter Zijlstra <peterz@infradead.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Breno Leitao <leitao@debian.org>, Tejun Heo <tj@kernel.org>,
David Vernet <void@manifault.com>,
Andrea Righi <arighi@nvidia.com>,
Changwoo Min <changwoo@igalia.com>,
Ingo Molnar <mingo@redhat.com>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Valentin Schneider <vschneid@redhat.com>,
sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org,
kernel-team@meta.com, jake@hillion.co.uk
Subject: Re: [PATCH] sched/ext: Suppress warning in __this_cpu_write() by disabling preemption
Date: Wed, 16 Jul 2025 15:06:52 +0200 [thread overview]
Message-ID: <20250716130652.GB3429938@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20250716085447.06feeb86@gandalf.local.home>
On Wed, Jul 16, 2025 at 08:54:47AM -0400, Steven Rostedt wrote:
> On Wed, 16 Jul 2025 05:46:15 -0700
> Breno Leitao <leitao@debian.org> wrote:
>
> > __this_cpu_write() emits a warning if used with preemption enabled.
> >
> > Function update_locked_rq() might be called with preemption enabled,
> > which causes the following warning:
> >
> > BUG: using __this_cpu_write() in preemptible [00000000] code: scx_layered_6-9/68770
> >
> > Disable preemption around the __this_cpu_write() call in
> > update_locked_rq() to suppress the warning, without affecting behavior.
> >
> > If preemption triggers a jump to another CPU during the callback it's
> > fine, since we would track the rq state on the other CPU with its own
> > local variable.
> >
> > Suggested-by: Andrea Righi <arighi@nvidia.com>
> > Signed-off-by: Breno Leitao <leitao@debian.org>
> > Fixes: 18853ba782bef ("sched_ext: Track currently locked rq")
> > Acked-by: Andrea Righi <arighi@nvidia.com>
> > ---
> > kernel/sched/ext.c | 7 +++++++
> > 1 file changed, 7 insertions(+)
> >
> > diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
> > index b498d867ba210..24fcbd7331f73 100644
> > --- a/kernel/sched/ext.c
> > +++ b/kernel/sched/ext.c
> > @@ -1258,7 +1258,14 @@ static inline void update_locked_rq(struct rq *rq)
> > */
> > if (rq)
> > lockdep_assert_rq_held(rq);
>
> <blink>
>
> If an rq lock is expected to be held, there had better be no preemption
> enabled. How is this OK?
The rq=NULL case; but from the usage I've seen that also happens with
rq lock held.
Specifically I think the check ought to be:
if (rq)
lockdep_assert_rq_held(rq)
else
lockdep_assert_rq_held(__this_cpu_read(locked_rq));
next prev parent reply other threads:[~2025-07-16 13:07 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-16 12:46 Breno Leitao
2025-07-16 12:51 ` Peter Zijlstra
2025-07-16 13:15 ` Andrea Righi
2025-07-16 13:20 ` Breno Leitao
2025-07-16 13:40 ` Peter Zijlstra
2025-07-16 13:36 ` Peter Zijlstra
2025-07-16 14:26 ` Andrea Righi
2025-07-16 15:49 ` Peter Zijlstra
2025-07-16 16:08 ` Breno Leitao
2025-07-16 16:13 ` Andrea Righi
2025-07-16 12:54 ` Steven Rostedt
2025-07-16 13:06 ` Peter Zijlstra [this message]
2025-07-16 13:20 ` Andrea Righi
2025-07-16 13:33 ` 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=20250716130652.GB3429938@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=arighi@nvidia.com \
--cc=bsegall@google.com \
--cc=changwoo@igalia.com \
--cc=dietmar.eggemann@arm.com \
--cc=jake@hillion.co.uk \
--cc=juri.lelli@redhat.com \
--cc=kernel-team@meta.com \
--cc=leitao@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
--cc=sched-ext@lists.linux.dev \
--cc=tj@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=void@manifault.com \
--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®