Re: [PATCH v2 2/2] cpufreq: Serialize global boost updates
From: Zhongqiu Han
Date: Thu Nov 05 2026 - 10:07:42 EST
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@xxxxxxx>
Reviewed-by: Pengjie Zhang <zhangpengjie2@xxxxxxxxxx>
---
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@xxxxxxxxxx/
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@xxxxxxx/
Thanks,
Sumit
--
Thx and BRs,
Zhongqiu Han