cpufreq: intel_pstate: Set non-turbo capacity to HWP_GUARANTEED_PERF()
Subsystems (2)
Rafael J. Wysocki
maintainerPATCH 1/1 cpufreq: intel_pstate: Set non-turbo capacity to HWP_GUARANTEED_PERF()
From: Rafael J. Wysocki <[email protected]>
Setting cpu->capacity_perf to cpu->pstate.max_pstate_physical in the "no turbo" case is inconsistent with what happens elsewhere in the driver and causes arch_scale_cpu_capacity() to be incorrect. It also skews arch_scale_freq_capacity() which ends up differing from 1024 for the guaranteed P-state.
Address that by setting capacity_perf to HWP_GUARANTEED_PERF() in the "no turbo" case.
--- drivers/cpufreq/intel_pstate.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/cpufreq/intel_pstate.c +4 -2
@@ -1007,12 +1007,14 @@ static void hybrid_clear_cpu_capacity(unstatic void hybrid_get_capacity_perf (struct cpudata *cpu) { +u64 hwp_cap =READ_ONCE (cpu->hwp_cap_cached); +if (READ_ONCE (global.no_turbo)) { - cpu->capacity_perf = cpu->pstate.max_pstate_physical; + cpu->capacity_perf =HWP_GUARANTEED_PERF (hwp_cap);return ; } - cpu->capacity_perf =HWP_HIGHEST_PERF (READ_ONCE (cpu->hwp_cap_cached)); + cpu->capacity_perf =HWP_HIGHEST_PERF (hwp_cap); }static void hybrid_set_capacity_of_cpus (void )
Quoted 10 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
Setting
cpu->capacity_perftocpu->pstate.max_pstate_physicalin the "no turbo" case is inconsistent with what happens elsewhere in the driver and causesarch_scale_cpu_capacity()to be incorrect. It also skewsarch_scale_freq_capacity()which ends up differing from 1024 for the guaranteed P-state.Address that by setting
capacity_perftoHWP_GUARANTEED_PERF()in the "no turbo" case.
Indeed, using cpu->pstate.max_pstate_physical does not make sense. It only reflects what PLATFORM_INFO[15:8] says for _all_ CPUs, regardless of type, resized by cpu->pstate.scaling/cpu->pstate.perf_ctl_scaling. No relation to any property of the CPU.
Now arch_scale_freq_capacity() looks correct.
Quoted 3 lines
Fixes 929ebc93ccaa ("cpufreq: intel_pstate: Set asymmetric CPU capacity on hybrid systems")Signed-off-by Rafael J. Wysocki <[email protected]>
Tested-by Ricardo Neri <[email protected]>