cpufreq: intel_pstate: Read all MSRs on the target CPU
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 24 Oct 2022 19:21:00 +0000 (21:21 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 25 Oct 2022 13:09:23 +0000 (15:09 +0200)
commit8dbab94d45fb1094cefac7956b7fb987a36e2b12
treeccdc202355186a5ebb6c7706c3b9852e70e05946
parent247f34f7b80357943234f93f247a1ae6b6c3a740
cpufreq: intel_pstate: Read all MSRs on the target CPU

Some of the MSR accesses in intel_pstate are carried out on the CPU
that is running the code, but the values coming from them are used
for the performance scaling of the other CPUs.

This is problematic, for example, on hybrid platforms where
MSR_TURBO_RATIO_LIMIT for P-cores and E-cores is different, so the
values read from it on a P-core are generally not applicable to E-cores
and the other way around.

For this reason, make the driver access all MSRs on the target CPU on
platforms using the "core" pstate_funcs callbacks which is the case for
all of the hybrid platforms released to date.  For this purpose, pass
a CPU argument to the ->get_max(), ->get_max_physical(), ->get_min()
and ->get_turbo() pstate_funcs callbacks and from there pass it to
rdmsrl_on_cpu() or rdmsrl_safe_on_cpu() to access the MSR on the target
CPU.

Fixes: 46573fd6369f ("cpufreq: intel_pstate: hybrid: Rework HWP calibration")
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Tested-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: 5.15+ <stable@vger.kernel.org> # 5.15+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/intel_pstate.c