[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0i3OBrhbXTpRAo3R3mrpjn8OJu874LtFAysAvziXmLxEA@mail.gmail.com>
Date: Wed, 16 Apr 2025 14:28:25 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Christian Loehle <christian.loehle@....com>
Cc: "Rafael J. Wysocki" <rjw@...ysocki.net>, Linux PM <linux-pm@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>, Viresh Kumar <viresh.kumar@...aro.org>,
Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>,
Mario Limonciello <mario.limonciello@....com>, Vincent Guittot <vincent.guittot@...aro.org>,
Sultan Alsawaf <sultan@...neltoast.com>, Peter Zijlstra <peterz@...radead.org>,
Valentin Schneider <vschneid@...hat.com>, Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH v2 2/6] cpufreq/sched: Explicitly synchronize
limits_changed flag handling
On Wed, Apr 16, 2025 at 2:01 PM Christian Loehle
<christian.loehle@....com> wrote:
>
> On 4/15/25 10:59, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> >
> > The handling of the limits_changed flag in struct sugov_policy needs to
> > be explicitly synchronized to ensure that cpufreq policy limits updates
> > will not be missed in some cases.
> >
> > Without that synchronization it is theoretically possible that
> > the limits_changed update in sugov_should_update_freq() will be
> > reordered with respect to the reads of the policy limits in
> > cpufreq_driver_resolve_freq() and in that case, if the limits_changed
> > update in sugov_limits() clobbers the one in sugov_should_update_freq(),
> > the new policy limits may not take effect for a long time.
> >
> > Likewise, the limits_changed update in sugov_limits() may theoretically
> > get reordered with respect to the updates of the policy limits in
> > cpufreq_set_policy() and if sugov_should_update_freq() runs between
> > them, the policy limits change may be missed.
> >
> > To ensure that the above situations will not take place, add memory
> > barriers preventing the reordering in question from taking place and
> > add READ_ONCE() and WRITE_ONCE() annotations around all of the
> > limits_changed flag updates to prevent the compiler from messing up
> > with that code.
> >
> > Fixes: 600f5badb78c ("cpufreq: schedutil: Don't skip freq update when limits change")
> > Cc: 5.3+ <stable@...r.nernel.org> # 5.3+
>
> typo in the address here.
Yup, thanks!
> I don't fully understand why we wouldn't want this in 6.15-rc already,
> even if the actual impact may be limited?
I wanted it to get some coverage in linux-next before it hits
mainline, but then it's -rc3 time frame, so there will still be 4
weeks of testing before the final release.
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
>
> Reviewed-by: Christian Loehle <christian.loehle@....com>
Thanks!
Powered by blists - more mailing lists