* [PATCH v2 0/2] cpufreq: Fix global boost state updates
@ 2026-11-05 9:03 Christian Loehle
2026-11-05 9:03 ` [PATCH v2 1/2] cpufreq: Preserve global boost state on failed updates Christian Loehle
2026-11-05 9:03 ` [PATCH v2 2/2] cpufreq: Serialize global boost updates Christian Loehle
0 siblings, 2 replies; 10+ messages in thread
From: Christian Loehle @ 2026-11-05 9:03 UTC (permalink / raw)
To: Rafael J . Wysocki, viresh.kumar
Cc: linux-pm, linux-kernel, sumitg, zhanjie9, superm1, zhangpengjie2
Preserve the global boost state on failure and serialize concurrent
global boost writes.
Changes in v2:
- Split rollback and serialization into separate patches, with the
corresponding Fixes tags (Zhongqiu Han)
- Carry Pengjie Zhang's Reviewed-by onto both patches since code
is unchanged.
v1: https://lore.kernel.org/r/20261104161657.546370-1-christian.loehle@arm.com
Christian Loehle (2):
cpufreq: Preserve global boost state on failed updates
cpufreq: Serialize global boost updates
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 1/2] cpufreq: Preserve global boost state on failed updates
2026-11-05 9:03 [PATCH v2 0/2] cpufreq: Fix global boost state updates Christian Loehle
@ 2026-11-05 9:03 ` Christian Loehle
2026-11-05 12:38 ` Zhongqiu Han
2026-11-05 14:36 ` Sumit Gupta
2026-11-05 9:03 ` [PATCH v2 2/2] cpufreq: Serialize global boost updates Christian Loehle
1 sibling, 2 replies; 10+ messages in thread
From: Christian Loehle @ 2026-11-05 9:03 UTC (permalink / raw)
To: Rafael J . Wysocki, viresh.kumar
Cc: linux-pm, linux-kernel, sumitg, zhanjie9, superm1, zhangpengjie2,
Christian Loehle
cpufreq_boost_trigger_state() restores the opposite of the requested
state when updating policy boost state fails. For example, a failed
write of 0 when global boost is already disabled enables the global
flag without enabling any policies.
Save the original global boost state and restore it on failure.
Fixes: 121baab7b88e ("cpufreq: Force sync policy boost with global boost on sysfs update")
Signed-off-by: Christian Loehle <christian.loehle@arm.com>
Reviewed-by: Pengjie Zhang <zhangpengjie2@huawei.com>
---
drivers/cpufreq/cpufreq.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 54dde8419bdc..23a77f5524df 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -2814,6 +2814,7 @@ static int cpufreq_boost_trigger_state(int state)
{
struct cpufreq_policy *policy;
unsigned long flags;
+ bool boost_enabled;
int ret = -EOPNOTSUPP;
/*
@@ -2822,6 +2823,7 @@ static int cpufreq_boost_trigger_state(int state)
*/
write_lock_irqsave(&cpufreq_driver_lock, flags);
+ boost_enabled = cpufreq_driver->boost_enabled;
cpufreq_driver->boost_enabled = state;
write_unlock_irqrestore(&cpufreq_driver_lock, flags);
@@ -2841,7 +2843,7 @@ static int cpufreq_boost_trigger_state(int state)
return 0;
write_lock_irqsave(&cpufreq_driver_lock, flags);
- cpufreq_driver->boost_enabled = !state;
+ cpufreq_driver->boost_enabled = boost_enabled;
write_unlock_irqrestore(&cpufreq_driver_lock, flags);
pr_err("%s: Cannot %s BOOST\n",
--
2.34.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 2/2] cpufreq: Serialize global boost updates
2026-11-05 9:03 [PATCH v2 0/2] cpufreq: Fix global boost state updates Christian Loehle
2026-11-05 9:03 ` [PATCH v2 1/2] cpufreq: Preserve global boost state on failed updates Christian Loehle
@ 2026-11-05 9:03 ` Christian Loehle
2026-11-05 14:41 ` Sumit Gupta
2026-11-05 15:01 ` Zhongqiu Han
1 sibling, 2 replies; 10+ messages in thread
From: Christian Loehle @ 2026-11-05 9:03 UTC (permalink / raw)
To: Rafael J . Wysocki, viresh.kumar
Cc: linux-pm, linux-kernel, sumitg, zhanjie9, superm1, zhangpengjie2,
Christian Loehle
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@arm.com>
Reviewed-by: Pengjie Zhang <zhangpengjie2@huawei.com>
---
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.
--
2.34.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 1/2] cpufreq: Preserve global boost state on failed updates
2026-11-05 9:03 ` [PATCH v2 1/2] cpufreq: Preserve global boost state on failed updates Christian Loehle
@ 2026-11-05 12:38 ` Zhongqiu Han
2026-11-05 14:36 ` Sumit Gupta
1 sibling, 0 replies; 10+ messages in thread
From: Zhongqiu Han @ 2026-11-05 12:38 UTC (permalink / raw)
To: Christian Loehle, Rafael J . Wysocki, viresh.kumar
Cc: linux-pm, linux-kernel, sumitg, zhanjie9, superm1, zhangpengjie2,
zhongqiu.han
On 11/5/2026 5:03 PM, Christian Loehle wrote:
> cpufreq_boost_trigger_state() restores the opposite of the requested
> state when updating policy boost state fails. For example, a failed
> write of 0 when global boost is already disabled enables the global
> flag without enabling any policies.
>
> Save the original global boost state and restore it on failure.
>
> Fixes: 121baab7b88e ("cpufreq: Force sync policy boost with global boost on sysfs update")
> Signed-off-by: Christian Loehle <christian.loehle@arm.com>
> Reviewed-by: Pengjie Zhang <zhangpengjie2@huawei.com>
Reviewed-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
> ---
> drivers/cpufreq/cpufreq.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 54dde8419bdc..23a77f5524df 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -2814,6 +2814,7 @@ static int cpufreq_boost_trigger_state(int state)
> {
> struct cpufreq_policy *policy;
> unsigned long flags;
> + bool boost_enabled;
> int ret = -EOPNOTSUPP;
>
> /*
> @@ -2822,6 +2823,7 @@ static int cpufreq_boost_trigger_state(int state)
> */
>
> write_lock_irqsave(&cpufreq_driver_lock, flags);
> + boost_enabled = cpufreq_driver->boost_enabled;
> cpufreq_driver->boost_enabled = state;
> write_unlock_irqrestore(&cpufreq_driver_lock, flags);
>
> @@ -2841,7 +2843,7 @@ static int cpufreq_boost_trigger_state(int state)
> return 0;
>
> write_lock_irqsave(&cpufreq_driver_lock, flags);
> - cpufreq_driver->boost_enabled = !state;
> + cpufreq_driver->boost_enabled = boost_enabled;
> write_unlock_irqrestore(&cpufreq_driver_lock, flags);
>
> pr_err("%s: Cannot %s BOOST\n",
--
Thx and BRs,
Zhongqiu Han
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 1/2] cpufreq: Preserve global boost state on failed updates
2026-11-05 9:03 ` [PATCH v2 1/2] cpufreq: Preserve global boost state on failed updates Christian Loehle
2026-11-05 12:38 ` Zhongqiu Han
@ 2026-11-05 14:36 ` Sumit Gupta
1 sibling, 0 replies; 10+ messages in thread
From: Sumit Gupta @ 2026-11-05 14:36 UTC (permalink / raw)
To: Christian Loehle, Rafael J . Wysocki, viresh.kumar
Cc: linux-pm, linux-kernel, zhanjie9, superm1, zhangpengjie2
On 05/11/26 14:33, Christian Loehle wrote:
> External email: Use caution opening links or attachments
>
>
> cpufreq_boost_trigger_state() restores the opposite of the requested
> state when updating policy boost state fails. For example, a failed
> write of 0 when global boost is already disabled enables the global
> flag without enabling any policies.
>
> Save the original global boost state and restore it on failure.
>
> Fixes: 121baab7b88e ("cpufreq: Force sync policy boost with global boost on sysfs update")
> Signed-off-by: Christian Loehle <christian.loehle@arm.com>
> Reviewed-by: Pengjie Zhang <zhangpengjie2@huawei.com>
> ---
Reviewed-by: Sumit Gupta <sumitg@nvidia.com>
> drivers/cpufreq/cpufreq.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 54dde8419bdc..23a77f5524df 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -2814,6 +2814,7 @@ static int cpufreq_boost_trigger_state(int state)
> {
> struct cpufreq_policy *policy;
> unsigned long flags;
> + bool boost_enabled;
> int ret = -EOPNOTSUPP;
>
> /*
> @@ -2822,6 +2823,7 @@ static int cpufreq_boost_trigger_state(int state)
> */
>
> write_lock_irqsave(&cpufreq_driver_lock, flags);
> + boost_enabled = cpufreq_driver->boost_enabled;
> cpufreq_driver->boost_enabled = state;
> write_unlock_irqrestore(&cpufreq_driver_lock, flags);
>
> @@ -2841,7 +2843,7 @@ static int cpufreq_boost_trigger_state(int state)
> return 0;
>
> write_lock_irqsave(&cpufreq_driver_lock, flags);
> - cpufreq_driver->boost_enabled = !state;
> + cpufreq_driver->boost_enabled = boost_enabled;
> write_unlock_irqrestore(&cpufreq_driver_lock, flags);
>
> pr_err("%s: Cannot %s BOOST\n",
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 2/2] cpufreq: Serialize global boost updates
2026-11-05 9:03 ` [PATCH v2 2/2] cpufreq: Serialize global boost updates Christian Loehle
@ 2026-11-05 14:41 ` Sumit Gupta
2026-11-05 15:01 ` Zhongqiu Han
2026-11-05 15:01 ` Zhongqiu Han
1 sibling, 1 reply; 10+ messages in thread
From: Sumit Gupta @ 2026-11-05 14:41 UTC (permalink / raw)
To: Christian Loehle, Rafael J . Wysocki, viresh.kumar
Cc: linux-pm, linux-kernel, zhanjie9, superm1, zhangpengjie2
On 05/11/26 14:33, Christian Loehle wrote:
> External email: Use caution opening links or attachments
>
>
> 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@arm.com>
> Reviewed-by: Pengjie Zhang <zhangpengjie2@huawei.com>
> ---
> 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);
> +
The policy->rwsem case from [1] seems to be still open. The per-policy
boost attribute calls policy_set_boost() with policy->rwsem held, but
cpufreq_boost_trigger_state() and cpufreq_online() don't, so they can
race with per-policy writers like ospm_nominal_freq in [1].
Could cpufreq_boost_trigger_state() take the policy lock, as
cpufreq_suspend() does?
scoped_guard(cpufreq_policy_write, policy)
ret = policy_set_boost(policy, state);
[1] https://lore.kernel.org/lkml/20261030172745.2045743-4-sumitg@nvidia.com/
Thanks,
Sumit
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 2/2] cpufreq: Serialize global boost updates
2026-11-05 14:41 ` Sumit Gupta
@ 2026-11-05 15:01 ` Zhongqiu Han
2026-11-05 16:17 ` Sumit Gupta
0 siblings, 1 reply; 10+ messages in thread
From: Zhongqiu Han @ 2026-11-05 15:01 UTC (permalink / raw)
To: Sumit Gupta, Christian Loehle, Rafael J . Wysocki, viresh.kumar
Cc: linux-pm, linux-kernel, zhanjie9, superm1, zhangpengjie2, Zhongqiu Han
On 11/5/2026 10:41 PM, Sumit Gupta wrote:
>
>
> On 05/11/26 14:33, Christian Loehle wrote:
>> External email: Use caution opening links or attachments
>>
>>
>> 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@arm.com>
>> Reviewed-by: Pengjie Zhang <zhangpengjie2@huawei.com>
>> ---
>> 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);
>> +
>
>
> The policy->rwsem case from [1] seems to be still open. The per-policy
> boost attribute calls policy_set_boost() with policy->rwsem held, but
> cpufreq_boost_trigger_state() and cpufreq_online() don't, so they can
> race with per-policy writers like ospm_nominal_freq in [1].
>
> Could cpufreq_boost_trigger_state() take the policy lock, as
> cpufreq_suspend() does?
>
> scoped_guard(cpufreq_policy_write, policy)
> ret = policy_set_boost(policy, state);
>
> [1] https://lore.kernel.org/lkml/20261030172745.2045743-4-
> sumitg@nvidia.com/
>
Hi Sumit,
Could you please check whether the following patch addresses the issue
you mentioned?
https://lore.kernel.org/all/be3739f8-e668-4711-912c-91459d77ed35@arm.com/
> Thanks,
> Sumit
>
>
--
Thx and BRs,
Zhongqiu Han
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 2/2] cpufreq: Serialize global boost updates
2026-11-05 9:03 ` [PATCH v2 2/2] cpufreq: Serialize global boost updates Christian Loehle
2026-11-05 14:41 ` Sumit Gupta
@ 2026-11-05 15:01 ` Zhongqiu Han
2026-11-05 18:49 ` Rafael J. Wysocki (Intel)
1 sibling, 1 reply; 10+ messages in thread
From: Zhongqiu Han @ 2026-11-05 15:01 UTC (permalink / raw)
To: Christian Loehle, Rafael J . Wysocki, viresh.kumar
Cc: linux-pm, linux-kernel, sumitg, zhanjie9, superm1, zhangpengjie2,
Zhongqiu Han
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@arm.com>
> Reviewed-by: Pengjie Zhang <zhangpengjie2@huawei.com>
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.
With that minor comment:
Reviewed-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
> ---
> 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 2/2] cpufreq: Serialize global boost updates
2026-11-05 15:01 ` Zhongqiu Han
@ 2026-11-05 16:17 ` Sumit Gupta
0 siblings, 0 replies; 10+ messages in thread
From: Sumit Gupta @ 2026-11-05 16:17 UTC (permalink / raw)
To: Zhongqiu Han, Christian Loehle, Rafael J . Wysocki, viresh.kumar
Cc: linux-pm, linux-kernel, zhanjie9, superm1, zhangpengjie2
On 05/11/26 20:31, Zhongqiu Han wrote:
> External email: Use caution opening links or attachments
>
>
> On 11/5/2026 10:41 PM, Sumit Gupta wrote:
>>
>>
>> On 05/11/26 14:33, Christian Loehle wrote:
>>> External email: Use caution opening links or attachments
>>>
>>>
>>> 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@arm.com>
>>> Reviewed-by: Pengjie Zhang <zhangpengjie2@huawei.com>
>>> ---
>>> 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);
>>> +
>>
>>
>> The policy->rwsem case from [1] seems to be still open. The per-policy
>> boost attribute calls policy_set_boost() with policy->rwsem held, but
>> cpufreq_boost_trigger_state() and cpufreq_online() don't, so they can
>> race with per-policy writers like ospm_nominal_freq in [1].
>>
>> Could cpufreq_boost_trigger_state() take the policy lock, as
>> cpufreq_suspend() does?
>>
>> scoped_guard(cpufreq_policy_write, policy)
>> ret = policy_set_boost(policy, state);
>>
>> [1] https://lore.kernel.org/lkml/20261030172745.2045743-4-
>> sumitg@nvidia.com/
>>
>
> Hi Sumit,
>
> Could you please check whether the following patch addresses the issue
> you mentioned?
>
> https://lore.kernel.org/all/be3739f8-e668-4711-912c-91459d77ed35@arm.com/
>
>
Yes, that covers it. I missed that. Please ignore my comment.
Reviewed-by: Sumit Gupta <sumitg@nvidia.com>
Thanks,
Sumit
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 2/2] cpufreq: Serialize global boost updates
2026-11-05 15:01 ` Zhongqiu Han
@ 2026-11-05 18:49 ` Rafael J. Wysocki (Intel)
0 siblings, 0 replies; 10+ messages in thread
From: Rafael J. Wysocki (Intel) @ 2026-11-05 18:49 UTC (permalink / raw)
To: Zhongqiu Han, Christian Loehle
Cc: viresh.kumar, linux-pm, linux-kernel, sumitg, zhanjie9, superm1,
zhangpengjie2
On Thu, Nov 5, 2026 at 4:01 PM Zhongqiu Han
<zhongqiu.han@oss.qualcomm.com> 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@arm.com>
> > Reviewed-by: Pengjie Zhang <zhangpengjie2@huawei.com>
>
> 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@oss.qualcomm.com>
>
> > ---
> > 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
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2026-11-05 18:50 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-05 9:03 [PATCH v2 0/2] cpufreq: Fix global boost state updates Christian Loehle
2026-11-05 9:03 ` [PATCH v2 1/2] cpufreq: Preserve global boost state on failed updates Christian Loehle
2026-11-05 12:38 ` Zhongqiu Han
2026-11-05 14:36 ` Sumit Gupta
2026-11-05 9:03 ` [PATCH v2 2/2] cpufreq: Serialize global boost updates Christian Loehle
2026-11-05 14:41 ` Sumit Gupta
2026-11-05 15:01 ` Zhongqiu Han
2026-11-05 16:17 ` Sumit Gupta
2026-11-05 15:01 ` Zhongqiu Han
2026-11-05 18:49 ` Rafael J. Wysocki (Intel)
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®