Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cpufreq: intel_pstate: Force HWP min perf before offline

Force HWP Request MAX = HWP Request MIN = HWP Capability MIN and EPP to
0xFF. In this way the performance limits on the offlined CPU will not
influence performance limits on its sibling CPU, which is still online.

If the sibling CPU is calling for higher performance, it will impact the
max core performance. Here core performance will follow higher of the
performance requests from each sibling.

Reported-and-tested-by: Chen Yu <yu.c.chen@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Srinivas Pandruvada and committed by
Rafael J. Wysocki
af3b7379 6e218d21

+26 -2
+26 -2
drivers/cpufreq/intel_pstate.c
··· 830 830 wrmsrl_on_cpu(cpu, MSR_HWP_REQUEST, value); 831 831 } 832 832 833 + static void intel_pstate_hwp_force_min_perf(int cpu) 834 + { 835 + u64 value; 836 + int min_perf; 837 + 838 + value = all_cpu_data[cpu]->hwp_req_cached; 839 + value &= ~GENMASK_ULL(31, 0); 840 + min_perf = HWP_LOWEST_PERF(all_cpu_data[cpu]->hwp_cap_cached); 841 + 842 + /* Set hwp_max = hwp_min */ 843 + value |= HWP_MAX_PERF(min_perf); 844 + value |= HWP_MIN_PERF(min_perf); 845 + 846 + /* Set EPP/EPB to min */ 847 + if (static_cpu_has(X86_FEATURE_HWP_EPP)) 848 + value |= HWP_ENERGY_PERF_PREFERENCE(HWP_EPP_POWERSAVE); 849 + else 850 + intel_pstate_set_epb(cpu, HWP_EPP_BALANCE_POWERSAVE); 851 + 852 + wrmsrl_on_cpu(cpu, MSR_HWP_REQUEST, value); 853 + } 854 + 833 855 static int intel_pstate_hwp_save_state(struct cpufreq_policy *policy) 834 856 { 835 857 struct cpudata *cpu_data = all_cpu_data[policy->cpu]; ··· 2106 2084 pr_debug("CPU %d exiting\n", policy->cpu); 2107 2085 2108 2086 intel_pstate_clear_update_util_hook(policy->cpu); 2109 - if (hwp_active) 2087 + if (hwp_active) { 2110 2088 intel_pstate_hwp_save_state(policy); 2111 - else 2089 + intel_pstate_hwp_force_min_perf(policy->cpu); 2090 + } else { 2112 2091 intel_cpufreq_stop_cpu(policy); 2092 + } 2113 2093 } 2114 2094 2115 2095 static int intel_pstate_cpu_exit(struct cpufreq_policy *policy)