cpufreq: intel_pstate: Fix unchecked HWP MSR access
Subsystems (2)
Srinivas Pandruvada
maintainerPATCH 1/1 cpufreq: intel_pstate: Fix unchecked HWP MSR access
Fix unchecked MSR access error for processors with no HWP support. On such processors, maximum frequency can be changed by the system firmware using ACPI event ACPI_PROCESSOR_NOTIFY_HIGEST_PERF_CHANGED. This results in accessing HWP MSR 0x771.
Call Trace: <TASK> generic_exec_single+0x58/0x120 smp_call_function_single+0xbf/0x110 rdmsrl_on_cpu+0x46/0x60 intel_pstate_get_hwp_cap+0x1b/0x70 intel_pstate_update_limits+0x2a/0x60 acpi_processor_notify+0xb7/0x140 acpi_ev_notify_dispatch+0x3b/0x60
HWP MSR 0x771 can be only read on a CPU which supports HWP and enabled. Hence intel_pstate_get_hwp_cap() can only be called when hwp_active is true.
--- drivers/cpufreq/intel_pstate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/cpufreq/intel_pstate.c +2 -1
@@ -1153,7 +1153,8 @@ static void intel_pstate_update_policies(void)static void __intel_pstate_update_max_freq (struct cpudata *cpudata,struct cpufreq_policy *policy) { -intel_pstate_get_hwp_cap (cpudata); +if (hwp_active) +intel_pstate_get_hwp_cap (cpudata); policy->cpuinfo.max_freq =READ_ONCE (global.no_turbo) ? cpudata->pstate.max_freq : cpudata->pstate.turbo_freq;
Signature · 1 line
2.25.1
Quoted 34 lines · Srinivas Pandruvada
Fix unchecked MSR access error for processors with no HWP support. On such processors, maximum frequency can be changed by the system firmware using ACPI event
ACPI_PROCESSOR_NOTIFY_HIGEST_PERF_CHANGED. This results in accessing HWP MSR0x771.Call Trace: <TASK> generic_exec_single+0x58/0x120 smp_call_function_single+0xbf/0x110 rdmsrl_on_cpu+0x46/0x60 intel_pstate_get_hwp_cap+0x1b/0x70 intel_pstate_update_limits+0x2a/0x60 acpi_processor_notify+0xb7/0x140 acpi_ev_notify_dispatch+0x3b/0x60HWP MSR
0x771can be only read on a CPU which supports HWP and enabled. Henceintel_pstate_get_hwp_cap()can only be called whenhwp_activeis true.Reported-by Sebastian Andrzej Siewior <[email protected]>Fixes e8217b4bece3 ("cpufreq: intel_pstate: Update the maximum CPU frequency consistently")Signed-off-by Srinivas Pandruvada <[email protected]>--- drivers/cpufreq/intel_pstate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/cpufreq/intel_pstate.c +0
-0
drivers/cpufreq/intel_pstate.c static void intel_pstate_update_policies(void)
Quoted 10 lines
drivers/cpufreq/intel_pstate.c +2
-2@@ -1153,7 +1153,8 @@ static void intel_pstate_update_policies(void)static void __intel_pstate_update_max_freq (struct cpudata *cpudata,struct cpufreq_policy *policy) { -intel_pstate_get_hwp_cap (cpudata); +if (hwp_active) +intel_pstate_get_hwp_cap (cpudata); policy->cpuinfo.max_freq =READ_ONCE (global.no_turbo) ? cpudata->pstate.max_freq : cpudata->pstate.turbo_freq; --
Applied as 6.10-rc material, thanks!