From: Qais Yousef <qyousef@layalina.io>
To: Christian Loehle <christian.loehle@arm.com>
Cc: Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
John Stultz <jstultz@google.com>,
linux-kernel@vger.kernel.org,
Kayra Cizmeci <kayracizmeci@gmail.com>,
Wei Wang <wvw@google.com>
Subject: Re: [PATCH v7 1/3] sched/uclamp: Fix race condition leading to imbalanced uclamp_rq
Date: Thu, 26 Nov 2026 11:48:09 +0000 [thread overview]
Message-ID: <awgaK3x8w1z_-Awa@aerith> (raw)
In-Reply-To: <32f8da5e-adbe-4b91-8bd5-d446a59e0c3b@arm.com>
> > -static void __init init_uclamp_rq(struct rq *rq)
> > +void init_uclamp_rq(struct rq *rq)
> > {
> > enum uclamp_id clamp_id;
> > struct uclamp_rq *uc_rq = rq->uclamp;
> >
> > for_each_clamp_id(clamp_id) {
> > - uc_rq[clamp_id] = (struct uclamp_rq) {
> > - .value = uclamp_none(clamp_id)
> > - };
> > + memset(uc_rq[clamp_id].bucket, 0, sizeof(uc_rq[clamp_id].bucket));
>
> nit: indent
Hmm I thought I fixed that before posting.
>
> > + uclamp_rq_set(rq, clamp_id, uclamp_none(clamp_id));
>
> So I did reproduce WARN_ON_ONCE(!bucket->tasks) on CONFIG_UCLAMP_TASK_GROUP=y, which
> relies on .active being in sync with bucket->active.
More details will make following your thoughts easier.
> FWIW I don't see a good way of mitigating the missed decrement for .active,
> but if somebody else sees it please shout.
> I'll post my proposal in a minute
Please send it on top of patch 2 and 3 at least as they are good clean ups that
I'd like them in still. I think the two approaches are not mutually exclusive
and the maintainers can pick both this patch and your other proposal
potentially.
Given that this imbalance can only (if at all) happen once after boot I don't
think that WARN_ON_ONCE() is consequential assuming we fail safe - which
I think we do but since you weren't specific about the path and I didn't go and
try to untangle it, I could have missed something.
FWIW, I think since there are no correctness issue but inconvenient _expected_
harmless warning, we are good. It could just make debugging harder if this
warning is due to the race or a true bug. All the sensible choices have some
imperfections..
next prev parent reply other threads:[~2026-11-26 11:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 1:28 [PATCH v7 0/3] Fix uclamp race against non atomic static key enable Qais Yousef
2026-11-26 1:28 ` [PATCH v7 1/3] sched/uclamp: Fix race condition leading to imbalanced uclamp_rq Qais Yousef
2026-11-26 10:05 ` Christian Loehle
2026-11-26 11:48 ` Qais Yousef [this message]
2026-11-26 1:28 ` [PATCH v7 2/3] sched/uclamp: Use wrappers instead of open coding UCLAMP_FLAG_IDLE Qais Yousef
2026-11-26 1:28 ` [PATCH v7 3/3] sched/uclamp: Move uclamp_rq_{inc, dec}() from core.c Qais Yousef
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=awgaK3x8w1z_-Awa@aerith \
--to=qyousef@layalina.io \
--cc=christian.loehle@arm.com \
--cc=dietmar.eggemann@arm.com \
--cc=jstultz@google.com \
--cc=kayracizmeci@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=wvw@google.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®