Skip to content

Commit 3d59224

Browse files
vireshkrafaeljw
authored andcommitted
cpufreq: ACPI: Re-sync CPU boost state on system resume
During CPU hotunplug events (such as those occurring during suspend/resume cycles), platform firmware may modify the CPU boost state. If boost was disabled prior to CPU removal, it correctly remains disabled upon re-plug. However, if firmware re-enables boost while the CPU is offline, the CPU may return with boost enabled—even if it was originally disabled—once it is hotplugged back in. This leads to inconsistent behavior and violates user or kernel policy expectations. To maintain consistency, ensure the boost state is re-synchronized with the kernel policy when a CPU is hotplugged back in. Note: This re-synchronization is not necessary during the initial call to ->init() for a CPU, as the cpufreq core handles it via cpufreq_online(). At that point, acpi_cpufreq_driver.boost_enabled is initialized to the value returned by boost_state(0). Fixes: 2b16c63 ("cpufreq: ACPI: Remove set_boost in acpi_cpufreq_cpu_init()") Reported-by: Nicholas Chin <nic.c3.14@gmail.com> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220013 Tested-by: Nicholas Chin <nic.c3.14@gmail.com> Reviewed-by: Lifeng Zheng <zhenglifeng1@huawei.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Link: https://patch.msgid.link/9c7de55fb06015c1b77e7dafd564b659838864e0.1745511526.git.viresh.kumar@linaro.org Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 5786ef8 commit 3d59224

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

drivers/cpufreq/acpi-cpufreq.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -909,8 +909,19 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
909909
if (perf->states[0].core_frequency * 1000 != freq_table[0].frequency)
910910
pr_warn(FW_WARN "P-state 0 is not max freq\n");
911911

912-
if (acpi_cpufreq_driver.set_boost)
913-
policy->boost_supported = true;
912+
if (acpi_cpufreq_driver.set_boost) {
913+
if (policy->boost_supported) {
914+
/*
915+
* The firmware may have altered boost state while the
916+
* CPU was offline (for example during a suspend-resume
917+
* cycle).
918+
*/
919+
if (policy->boost_enabled != boost_state(cpu))
920+
set_boost(policy, policy->boost_enabled);
921+
} else {
922+
policy->boost_supported = true;
923+
}
924+
}
914925

915926
return result;
916927

0 commit comments

Comments
 (0)