Re: [RFC PATCH] cpufreq: Keep global boost enabled after partial enable

From: Jiangtian Feng

Date: Fri Nov 27 2026 - 01:00:07 EST


On Thu, 26 Nov 2026 23:09:42 +0800, Zhongqiu Han wrote:
> Yeah, it is a real issue, global boost "only means a permission to use
> the frequency boost mechanism" (cpufreq.rst), and "per-policy boost can
> then be enabled or disabled individually" while "disabling global boost
> makes the per-policy boost interface illegal" (commit 218a06a79d9a).

Thank you for confirming the state semantics. That is the inconsistency
this RFC is intended to address.

> This function uses guard(), and cleanup.h says "usage of "goto" and
> cleanup helpers is never mixed in the same function".

Accepted. v2 removes both the goto and out_err label from this function.

> Besides, the !boost_enabled check is redundant, right? so maybe:
>
> if (!state || !policy_success) {
> write_lock_irqsave(&cpufreq_driver_lock, flags);
> cpufreq_driver->boost_enabled = boost_enabled;
> write_unlock_irqrestore(&cpufreq_driver_lock, flags);
> }

Accepted. v2 uses this condition. When the old global value is already
1, skipping the restore is equivalent because the restore would only
write 1 again.

> Separately, the disable side can end up in a similar state: if global
> boost is already 0 and a resync write of 0 fails on some policy, that
> policy stays boosted under global boost = 0. That's outside the scope
> of this patch, though.

Agreed. I have left that case for separate discussion rather than
expanding this patch.

I should also acknowledge that the v2 changelog and comment retained the
v1 wording. I will correct both in v3 and include per-version changes and
links to the previous postings. I should have replied to these comments
before posting v2, and will do so for subsequent revisions.

Best regards,
Jiangtian