[PATCH 1/2] cpufreq: Allow global boost updates with inactive capable policies

From: Jiangtian Feng

Date: Mon Nov 30 2026 - 06:14:13 EST


Global boost is a permission to use boost, not a statement that boost is
currently active on every policy. A boost-capable policy can be inactive or
offline when the global knob is written. Rejecting the write in that case
loses the requested global setting and makes the policy list state affect
the result in a way that is not useful to userspace.

Track boost support across all registered policies under cpus_read_lock,
but continue to call policy_set_boost() only for active, boost-capable
policies. An inactive boost-capable policy therefore no longer makes the
global write fail, and the requested setting can be applied when it becomes
active again.

Preserve the -EOPNOTSUPP result when no registered policy supports boost,
as introduced by 77cf053b041f, and leave all real policy_set_boost()
failures unchanged.

Link: https://lore.kernel.org/all/744b868b-55af-4a12-86a8-f4fd5d132e6a@xxxxxxxxxx/
Link: https://lore.kernel.org/all/wnnfdvp3r3bg5wztazoijei2uji5xypl4b4wlvlxuwxaizu6g7@2xxyrk7kdxhf/

Qoder, an AI coding assistant, helped analyze the 77cf history, review the
policy-list locking/lifetime and draft this change and description. The
policy state matrix and hardware/hotplug behavior remain subject to final
review and validation.

Signed-off-by: Jiangtian Feng <jiangtianfeng@xxxxxxxxxxxxxxxxx>
---
drivers/cpufreq/cpufreq.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 4332cb114070..f83fc6e40fbe 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -2887,7 +2887,8 @@ static int cpufreq_boost_trigger_state(int state)
struct cpufreq_policy *policy;
unsigned long flags;
bool boost_enabled;
- int ret = -EOPNOTSUPP;
+ bool any_boost_supported = false;
+ int ret = 0;

guard(mutex)(&cpufreq_boost_mutex);

@@ -2902,8 +2903,11 @@ static int cpufreq_boost_trigger_state(int state)
write_unlock_irqrestore(&cpufreq_driver_lock, flags);

cpus_read_lock();
- for_each_active_policy(policy) {
- if (!policy->boost_supported)
+ /* Track capability across inactive policies, but only update active ones. */
+ for_each_policy(policy) {
+ if (policy->boost_supported)
+ any_boost_supported = true;
+ if (policy_is_inactive(policy) || !policy->boost_supported)
continue;

guard(cpufreq_policy_write)(policy);
@@ -2913,6 +2917,9 @@ static int cpufreq_boost_trigger_state(int state)
break;
}

+ if (!any_boost_supported)
+ ret = -EOPNOTSUPP;
+
cpus_read_unlock();

if (likely(!ret))
--
2.47.3