cpufreq: intel_pstate: Lower frequency than expected under no_turbo
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Wed, 18 Jan 2017 18:48:23 +0000 (10:48 -0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 3 Feb 2017 23:05:32 +0000 (00:05 +0100)
When turbo is not disabled by BIOS, but user disabled from intel P-State
sysfs and changes max/min using cpufreq sysfs, the resultant frequency
is lower than what user requested.

The reason for this, when the perf limits are calculated in set_policy()
callback, they are with reference to max cpu frequency (turbo frequency
), but when enforced in the intel_pstate_get_min_max() they are with
reference to max available performance as documented in the intel_pstate
documentation (in this case max non turbo P-State).

This needs similar change as done in intel_cpufreq_verify_policy() for
passive mode. Set policy->cpuinfo.max_freq based on the turbo status.

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

index c783151..735e3e8 100644 (file)
@@ -2153,6 +2153,20 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy)
 
 static int intel_pstate_verify_policy(struct cpufreq_policy *policy)
 {
+       struct cpudata *cpu = all_cpu_data[policy->cpu];
+       struct perf_limits *perf_limits;
+
+       if (policy->policy == CPUFREQ_POLICY_PERFORMANCE)
+               perf_limits = &performance_limits;
+       else
+               perf_limits = &powersave_limits;
+
+       update_turbo_state();
+       policy->cpuinfo.max_freq = perf_limits->turbo_disabled ||
+                                       perf_limits->no_turbo ?
+                                       cpu->pstate.max_freq :
+                                       cpu->pstate.turbo_freq;
+
        cpufreq_verify_within_cpu_limits(policy);
 
        if (policy->policy != CPUFREQ_POLICY_POWERSAVE &&