aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDirk Brandewie <dirk.j.brandewie@intel.com>2013-05-07 11:20:26 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-05-12 08:04:16 -0400
commitd8f469e9cff3bc4a6317d923e9506be046aa7bdc (patch)
tree0b344b04e6c4b53bb821f2b5084099aa17c2a362
parent1abc4b20b85b42e8573957e54b193385cf48b0d6 (diff)
cpufreq / intel_pstate: use lowest requested max performance
There are two ways that the maximum p-state can be clamped, via a policy change and via the sysfs file. The acpi-thermal driver adjusts the p-state policy in response to thermal events. These changes override the users settings at the moment. Use the lowest of the two requested values this ensures that we will not exceed the requested pstate from either mechanism. Reported-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Cc: 3.9+ <stable@vger.kernel.org> Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/cpufreq/intel_pstate.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index c6e10d02b795..4a437ffc5186 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -117,6 +117,8 @@ struct perf_limits {
117 int min_perf_pct; 117 int min_perf_pct;
118 int32_t max_perf; 118 int32_t max_perf;
119 int32_t min_perf; 119 int32_t min_perf;
120 int max_policy_pct;
121 int max_sysfs_pct;
120}; 122};
121 123
122static struct perf_limits limits = { 124static struct perf_limits limits = {
@@ -125,6 +127,8 @@ static struct perf_limits limits = {
125 .max_perf = int_tofp(1), 127 .max_perf = int_tofp(1),
126 .min_perf_pct = 0, 128 .min_perf_pct = 0,
127 .min_perf = 0, 129 .min_perf = 0,
130 .max_policy_pct = 100,
131 .max_sysfs_pct = 100,
128}; 132};
129 133
130static inline void pid_reset(struct _pid *pid, int setpoint, int busy, 134static inline void pid_reset(struct _pid *pid, int setpoint, int busy,
@@ -295,7 +299,8 @@ static ssize_t store_max_perf_pct(struct kobject *a, struct attribute *b,
295 if (ret != 1) 299 if (ret != 1)
296 return -EINVAL; 300 return -EINVAL;
297 301
298 limits.max_perf_pct = clamp_t(int, input, 0 , 100); 302 limits.max_sysfs_pct = clamp_t(int, input, 0 , 100);
303 limits.max_perf_pct = min(limits.max_policy_pct, limits.max_sysfs_pct);
299 limits.max_perf = div_fp(int_tofp(limits.max_perf_pct), int_tofp(100)); 304 limits.max_perf = div_fp(int_tofp(limits.max_perf_pct), int_tofp(100));
300 return count; 305 return count;
301} 306}
@@ -646,8 +651,9 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy)
646 limits.min_perf_pct = clamp_t(int, limits.min_perf_pct, 0 , 100); 651 limits.min_perf_pct = clamp_t(int, limits.min_perf_pct, 0 , 100);
647 limits.min_perf = div_fp(int_tofp(limits.min_perf_pct), int_tofp(100)); 652 limits.min_perf = div_fp(int_tofp(limits.min_perf_pct), int_tofp(100));
648 653
649 limits.max_perf_pct = policy->max * 100 / policy->cpuinfo.max_freq; 654 limits.max_policy_pct = policy->max * 100 / policy->cpuinfo.max_freq;
650 limits.max_perf_pct = clamp_t(int, limits.max_perf_pct, 0 , 100); 655 limits.max_policy_pct = clamp_t(int, limits.max_policy_pct, 0 , 100);
656 limits.max_perf_pct = min(limits.max_policy_pct, limits.max_sysfs_pct);
651 limits.max_perf = div_fp(int_tofp(limits.max_perf_pct), int_tofp(100)); 657 limits.max_perf = div_fp(int_tofp(limits.max_perf_pct), int_tofp(100));
652 658
653 return 0; 659 return 0;