diff options
author | Kristen Carlson Accardi <kristen@linux.intel.com> | 2015-01-29 16:03:52 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-01-29 19:52:17 -0500 |
commit | a04759924e2528c5cc2af49b183c5638fe8d9bed (patch) | |
tree | cc3a690e3e4f5c9c073a8155f627484deed15c3f | |
parent | 630ec286dd85c5838493ab7ef975881c42069ef0 (diff) |
intel_pstate: honor user space min_perf_pct override on resume
If the user has requested an override of the min_perf_pct via
sysfs, then it should be restored whenever policy is updated,
such as on resume. Take the max of whatever the user requested
and whatever the policy is.
Signed-off-by: Kristen Carlson Accardi <kristen@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/cpufreq/intel_pstate.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index dfee5725903b..e7e808d9a8af 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c | |||
@@ -148,6 +148,8 @@ struct perf_limits { | |||
148 | int32_t min_perf; | 148 | int32_t min_perf; |
149 | int max_policy_pct; | 149 | int max_policy_pct; |
150 | int max_sysfs_pct; | 150 | int max_sysfs_pct; |
151 | int min_policy_pct; | ||
152 | int min_sysfs_pct; | ||
151 | }; | 153 | }; |
152 | 154 | ||
153 | static struct perf_limits limits = { | 155 | static struct perf_limits limits = { |
@@ -159,6 +161,8 @@ static struct perf_limits limits = { | |||
159 | .min_perf = 0, | 161 | .min_perf = 0, |
160 | .max_policy_pct = 100, | 162 | .max_policy_pct = 100, |
161 | .max_sysfs_pct = 100, | 163 | .max_sysfs_pct = 100, |
164 | .min_policy_pct = 0, | ||
165 | .min_sysfs_pct = 0, | ||
162 | }; | 166 | }; |
163 | 167 | ||
164 | static inline void pid_reset(struct _pid *pid, int setpoint, int busy, | 168 | static inline void pid_reset(struct _pid *pid, int setpoint, int busy, |
@@ -431,7 +435,9 @@ static ssize_t store_min_perf_pct(struct kobject *a, struct attribute *b, | |||
431 | ret = sscanf(buf, "%u", &input); | 435 | ret = sscanf(buf, "%u", &input); |
432 | if (ret != 1) | 436 | if (ret != 1) |
433 | return -EINVAL; | 437 | return -EINVAL; |
434 | limits.min_perf_pct = clamp_t(int, input, 0 , 100); | 438 | |
439 | limits.min_sysfs_pct = clamp_t(int, input, 0 , 100); | ||
440 | limits.min_perf_pct = max(limits.min_policy_pct, limits.min_sysfs_pct); | ||
435 | limits.min_perf = div_fp(int_tofp(limits.min_perf_pct), int_tofp(100)); | 441 | limits.min_perf = div_fp(int_tofp(limits.min_perf_pct), int_tofp(100)); |
436 | 442 | ||
437 | if (hwp_active) | 443 | if (hwp_active) |
@@ -921,6 +927,7 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy) | |||
921 | 927 | ||
922 | if (policy->policy == CPUFREQ_POLICY_PERFORMANCE && | 928 | if (policy->policy == CPUFREQ_POLICY_PERFORMANCE && |
923 | policy->max >= policy->cpuinfo.max_freq) { | 929 | policy->max >= policy->cpuinfo.max_freq) { |
930 | limits.min_policy_pct = 100; | ||
924 | limits.min_perf_pct = 100; | 931 | limits.min_perf_pct = 100; |
925 | limits.min_perf = int_tofp(1); | 932 | limits.min_perf = int_tofp(1); |
926 | limits.max_policy_pct = 100; | 933 | limits.max_policy_pct = 100; |
@@ -930,8 +937,9 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy) | |||
930 | return 0; | 937 | return 0; |
931 | } | 938 | } |
932 | 939 | ||
933 | limits.min_perf_pct = (policy->min * 100) / policy->cpuinfo.max_freq; | 940 | limits.min_policy_pct = (policy->min * 100) / policy->cpuinfo.max_freq; |
934 | limits.min_perf_pct = clamp_t(int, limits.min_perf_pct, 0 , 100); | 941 | limits.min_policy_pct = clamp_t(int, limits.min_policy_pct, 0 , 100); |
942 | limits.min_perf_pct = max(limits.min_policy_pct, limits.min_sysfs_pct); | ||
935 | limits.min_perf = div_fp(int_tofp(limits.min_perf_pct), int_tofp(100)); | 943 | limits.min_perf = div_fp(int_tofp(limits.min_perf_pct), int_tofp(100)); |
936 | 944 | ||
937 | limits.max_policy_pct = (policy->max * 100) / policy->cpuinfo.max_freq; | 945 | limits.max_policy_pct = (policy->max * 100) / policy->cpuinfo.max_freq; |