]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
cpufreq: intel_pstate: Sync policy->cur during CPU offline
authorFushuai Wang <wangfushuai@baidu.com>
Wed, 20 May 2026 03:21:19 +0000 (11:21 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 22 May 2026 15:35:50 +0000 (17:35 +0200)
When a CPU goes offline with HWP disabled, intel_pstate_set_min_pstate()
sets the MSR_IA32_PERF_CTL to minimum frequency to prevent SMT siblings
from being restricted. However, the policy->cur value was not updated,
leaving it at the previous value.

When the CPU comes back online, governor->limits() checks if target_freq
equals policy->cur and skips the frequency adjustment if they match. Since
policy->cur still holds the previous value, the governor does not call
cpufreq_driver->target to update MSR_IA32_PERF_CTL.

Fix this by synchronizing policy->cur with the hardware state when setting
minimum pstate during CPU offline.

Fixes: bb18008f8086 ("intel_pstate: Set core to min P state during core offline")
Cc: stable@vger.kernel.org # 3.15+
Suggested-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Fushuai Wang <wangfushuai@baidu.com>
[ rjw: Subject refinement ]
Link: https://patch.msgid.link/20260520032119.30615-1-fushuai.wang@linux.dev
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/intel_pstate.c

index 1f093e34643014a93b424397247b31837fe246ed..0fbbdbd5765cfb27d6785cdedabc33f3d54ecdcd 100644 (file)
@@ -2984,10 +2984,12 @@ static int intel_cpufreq_cpu_offline(struct cpufreq_policy *policy)
         * from getting to lower performance levels, so force the minimum
         * performance on CPU offline to prevent that from happening.
         */
-       if (hwp_active)
+       if (hwp_active) {
                intel_pstate_hwp_offline(cpu);
-       else
+       } else {
                intel_pstate_set_min_pstate(cpu);
+               policy->cur = cpu->pstate.min_freq;
+       }
 
        intel_pstate_exit_perf_limits(policy);