Skip to content

Commit af3b737

Browse files
spandruvadarafaeljw
authored andcommitted
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>
1 parent 6e218d2 commit af3b737

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

drivers/cpufreq/intel_pstate.c

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,28 @@ static void intel_pstate_hwp_set(unsigned int cpu)
830830
wrmsrl_on_cpu(cpu, MSR_HWP_REQUEST, value);
831831
}
832832

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+
833855
static int intel_pstate_hwp_save_state(struct cpufreq_policy *policy)
834856
{
835857
struct cpudata *cpu_data = all_cpu_data[policy->cpu];
@@ -2084,10 +2106,12 @@ static void intel_pstate_stop_cpu(struct cpufreq_policy *policy)
20842106
pr_debug("CPU %d exiting\n", policy->cpu);
20852107

20862108
intel_pstate_clear_update_util_hook(policy->cpu);
2087-
if (hwp_active)
2109+
if (hwp_active) {
20882110
intel_pstate_hwp_save_state(policy);
2089-
else
2111+
intel_pstate_hwp_force_min_perf(policy->cpu);
2112+
} else {
20902113
intel_cpufreq_stop_cpu(policy);
2114+
}
20912115
}
20922116

20932117
static int intel_pstate_cpu_exit(struct cpufreq_policy *policy)

0 commit comments

Comments
 (0)