cpufreq: intel_pstate: Revise global turbo disable check
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Thu, 7 Sep 2023 18:02:07 +0000 (11:02 -0700)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 11 Sep 2023 18:18:17 +0000 (20:18 +0200)
commit37b6ddba967c601479bea418a7ac6ff16b6232b7
tree08fdb8b26e70cb8aa70b01372af04d96d78f675e
parent0bb80ecc33a8fb5a682236443c1e740d5c917d1d
cpufreq: intel_pstate: Revise global turbo disable check

Setting global turbo flag based on CPU 0 P-state limits is problematic
as it limits max P-state request on every CPU on the system just based
on its P-state limits.

There are two cases in which global.turbo_disabled flag is set:
- When the MSR_IA32_MISC_ENABLE_TURBO_DISABLE bit is set to 1
in the MSR MSR_IA32_MISC_ENABLE. This bit can be only changed by
the system BIOS before power up.
- When the max non turbo P-state is same as max turbo P-state for CPU 0.

The second check is not a valid to decide global turbo state based on
the CPU 0. CPU 0 max turbo P-state can be same as max non turbo P-state,
but for other CPUs this may not be true.

There is no guarantee that max P-state limits are same for every CPU. This
is possible that during fusing max P-state for a CPU is constrained. Also
with the Intel Speed Select performance profile, CPU 0 may not be present
in all profiles. In this case the max non turbo and turbo P-state can be
set to the lowest possible P-state by the hardware when switched to
such profile. Since max non turbo and turbo P-state is same,
global.turbo_disabled flag will be set.

Once global.turbo_disabled is set, any scaling max and min frequency
update for any CPU will result in its max P-state constrained to the max
non turbo P-state.

Hence remove the check of max non turbo P-state equal to max turbo P-state
of CPU 0 to set global turbo disabled flag.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
[ rjw: Subject edit ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/intel_pstate.c