Re: [PATCH v2 2/2] cpufreq: Serialize global boost updates
From: Rafael J. Wysocki (Intel)
Date: Thu Nov 05 2026 - 13:52:23 EST
On Thu, Nov 5, 2026 at 4:01 PM Zhongqiu Han
<zhongqiu.han@xxxxxxxxxxxxxxxx> wrote:
>
> On 11/5/2026 5:03 PM, Christian Loehle wrote:
> > Serialize concurrent global boost sysfs writes with a mutex.
> >
> > Fixes: 6f19efc0a1ca ("cpufreq: Add boost frequency support in core")
> > Signed-off-by: Christian Loehle <christian.loehle@xxxxxxx>
> > Reviewed-by: Pengjie Zhang <zhangpengjie2@xxxxxxxxxx>
>
> The change looks good to me. It might be worth expanding the commit
> message a little to describe the race between concurrent global boost
> sysfs writes and why serialization is needed.
Yeah, it would be good to say why this change is necessary.
> With that minor comment:
>
> Reviewed-by: Zhongqiu Han <zhongqiu.han@xxxxxxxxxxxxxxxx>
>
> > ---
> > drivers/cpufreq/cpufreq.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> > index 23a77f5524df..d95c849f79c5 100644
> > --- a/drivers/cpufreq/cpufreq.c
> > +++ b/drivers/cpufreq/cpufreq.c
> > @@ -2810,6 +2810,8 @@ int cpufreq_boost_set_sw(struct cpufreq_policy *policy, int state)
> > }
> > EXPORT_SYMBOL_GPL(cpufreq_boost_set_sw);
> >
> > +static DEFINE_MUTEX(cpufreq_boost_mutex);
> > +
> > static int cpufreq_boost_trigger_state(int state)
> > {
> > struct cpufreq_policy *policy;
> > @@ -2817,6 +2819,8 @@ static int cpufreq_boost_trigger_state(int state)
> > bool boost_enabled;
> > int ret = -EOPNOTSUPP;
> >
> > + guard(mutex)(&cpufreq_boost_mutex);
> > +
> > /*
> > * Don't compare 'cpufreq_driver->boost_enabled' with 'state' here to
> > * make sure all policies are in sync with global boost flag.
>
>
> --
> Thx and BRs,
> Zhongqiu Han