aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-10-18 20:57:22 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-10-21 16:18:22 -0400
commita6c6ead14183ea4ec8ce7551e1f3451024b9c4db (patch)
tree4d83d3c8a987c477ecae017915c7aee58afceafc
parentc6fe46a79ecd79606bb96fada4515f6b23f87b62 (diff)
cpufreq: intel_pstate: Set P-state upfront in performance mode
After commit a4675fbc4a7a (cpufreq: intel_pstate: Replace timers with utilization update callbacks) the cpufreq governor callbacks may not be invoked on NOHZ_FULL CPUs and, in particular, switching to the "performance" policy via sysfs may not have any effect on them. That is a problem, because it usually is desirable to squeeze the last bit of performance out of those CPUs, so work around it by setting the maximum P-state (within the limits) in intel_pstate_set_policy() upfront when the policy is CPUFREQ_POLICY_PERFORMANCE. Fixes: a4675fbc4a7a (cpufreq: intel_pstate: Replace timers with utilization update callbacks) Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
-rw-r--r--drivers/cpufreq/intel_pstate.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index f535f8123258..ac7c58d20b58 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -1142,10 +1142,8 @@ static void intel_pstate_get_min_max(struct cpudata *cpu, int *min, int *max)
1142 *min = clamp_t(int, min_perf, cpu->pstate.min_pstate, max_perf); 1142 *min = clamp_t(int, min_perf, cpu->pstate.min_pstate, max_perf);
1143} 1143}
1144 1144
1145static void intel_pstate_set_min_pstate(struct cpudata *cpu) 1145static void intel_pstate_set_pstate(struct cpudata *cpu, int pstate)
1146{ 1146{
1147 int pstate = cpu->pstate.min_pstate;
1148
1149 trace_cpu_frequency(pstate * cpu->pstate.scaling, cpu->cpu); 1147 trace_cpu_frequency(pstate * cpu->pstate.scaling, cpu->cpu);
1150 cpu->pstate.current_pstate = pstate; 1148 cpu->pstate.current_pstate = pstate;
1151 /* 1149 /*
@@ -1157,6 +1155,20 @@ static void intel_pstate_set_min_pstate(struct cpudata *cpu)
1157 pstate_funcs.get_val(cpu, pstate)); 1155 pstate_funcs.get_val(cpu, pstate));
1158} 1156}
1159 1157
1158static void intel_pstate_set_min_pstate(struct cpudata *cpu)
1159{
1160 intel_pstate_set_pstate(cpu, cpu->pstate.min_pstate);
1161}
1162
1163static void intel_pstate_max_within_limits(struct cpudata *cpu)
1164{
1165 int min_pstate, max_pstate;
1166
1167 update_turbo_state();
1168 intel_pstate_get_min_max(cpu, &min_pstate, &max_pstate);
1169 intel_pstate_set_pstate(cpu, max_pstate);
1170}
1171
1160static void intel_pstate_get_cpu_pstates(struct cpudata *cpu) 1172static void intel_pstate_get_cpu_pstates(struct cpudata *cpu)
1161{ 1173{
1162 cpu->pstate.min_pstate = pstate_funcs.get_min(); 1174 cpu->pstate.min_pstate = pstate_funcs.get_min();
@@ -1491,7 +1503,7 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy)
1491 pr_debug("set_policy cpuinfo.max %u policy->max %u\n", 1503 pr_debug("set_policy cpuinfo.max %u policy->max %u\n",
1492 policy->cpuinfo.max_freq, policy->max); 1504 policy->cpuinfo.max_freq, policy->max);
1493 1505
1494 cpu = all_cpu_data[0]; 1506 cpu = all_cpu_data[policy->cpu];
1495 if (cpu->pstate.max_pstate_physical > cpu->pstate.max_pstate && 1507 if (cpu->pstate.max_pstate_physical > cpu->pstate.max_pstate &&
1496 policy->max < policy->cpuinfo.max_freq && 1508 policy->max < policy->cpuinfo.max_freq &&
1497 policy->max > cpu->pstate.max_pstate * cpu->pstate.scaling) { 1509 policy->max > cpu->pstate.max_pstate * cpu->pstate.scaling) {
@@ -1535,6 +1547,15 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy)
1535 limits->max_perf = round_up(limits->max_perf, FRAC_BITS); 1547 limits->max_perf = round_up(limits->max_perf, FRAC_BITS);
1536 1548
1537 out: 1549 out:
1550 if (policy->policy == CPUFREQ_POLICY_PERFORMANCE) {
1551 /*
1552 * NOHZ_FULL CPUs need this as the governor callback may not
1553 * be invoked on them.
1554 */
1555 intel_pstate_clear_update_util_hook(policy->cpu);
1556 intel_pstate_max_within_limits(cpu);
1557 }
1558
1538 intel_pstate_set_update_util_hook(policy->cpu); 1559 intel_pstate_set_update_util_hook(policy->cpu);
1539 1560
1540 intel_pstate_hwp_set_policy(policy); 1561 intel_pstate_hwp_set_policy(policy);