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

From: Pengjie Zhang

Date: Mon Nov 30 2026 - 08:49:44 EST


Hi Jiangtian,

Thanks for handling the offline case in v5.

With 5785772fe9e6 ("cpufreq: CPPC: Enable boost by default") [1] in
linux-pm/linux-next, the global boost knob can start at 1 on a CPPC
system where no registered policy supports boost. With the v5 core
changes applied on top, writing 0 would still return -EINVAL and
leave the knob at 1.

I understand that 77cf053b041f deliberately made this an error.
Since the global knob controls permission to boost, could we let
userspace write either 0 or 1 and read that value back even when
no policy supports boost? A successful write of 0 must leave boost
disabled on every active policy that supports it.

[1] https://lore.kernel.org/all/20261118013558.3075038-1-zhangpengjie2@xxxxxxxxxx/

Thanks,
Pengjie

On 11/30/2026 7:13 PM, Jiangtian Feng wrote:
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))