[PATCH v2 2/2] cpufreq: Serialize global boost updates

From: Christian Loehle

Date: Thu Nov 05 2026 - 04:05:47 EST


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);
+
/*
* 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