Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1602907
| From | "Rafael J. Wysocki" <rjw@rjwysocki.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] cpufreq: Restore policy min/max limits on CPU online |
| Date | 2017-03-17 00:00 +0100 |
| Message-ID | <tlMxc-56x-17@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
On CPU online the cpufreq core restores the previous governor (or
the previous "policy" setting for ->setpolicy drivers), but it does
not restore the min/max limits at the same time, which is confusing,
inconsistent and real pain for users who set the limits and then
suspend/resume the system (using full suspend), in which case the
limits are reset on all CPUs except for the boot one.
Fix this by making cpufreq_init_policy() restore the limits when it
sees that this is CPU online and not initialization from scratch.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/cpufreq/cpufreq.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
Index: linux-pm/drivers/cpufreq/cpufreq.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/cpufreq.c
+++ linux-pm/drivers/cpufreq/cpufreq.c
@@ -979,6 +979,8 @@ static int cpufreq_init_policy(struct cp
/* Update governor of new_policy to the governor used before hotplug */
gov = find_governor(policy->last_governor);
if (gov) {
+ new_policy.min = policy->user_policy.min;
+ new_policy.max = policy->user_policy.max;
pr_debug("Restoring governor %s for cpu %d\n",
policy->governor->name, policy->cpu);
} else {
@@ -991,11 +993,14 @@ static int cpufreq_init_policy(struct cp
/* Use the default policy if there is no last_policy. */
if (cpufreq_driver->setpolicy) {
- if (policy->last_policy)
+ if (policy->last_policy) {
new_policy.policy = policy->last_policy;
- else
+ new_policy.min = policy->user_policy.min;
+ new_policy.max = policy->user_policy.max;
+ } else {
cpufreq_parse_governor(gov->name, &new_policy.policy,
NULL);
+ }
}
/* set default policy */
return cpufreq_set_policy(policy, &new_policy);
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] cpufreq: Restore policy min/max limits on CPU online "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-03-17 00:00 +0100
Re: [PATCH] cpufreq: Restore policy min/max limits on CPU online Viresh Kumar <viresh.kumar@linaro.org> - 2017-03-17 04:30 +0100
Re: [PATCH] cpufreq: Restore policy min/max limits on CPU online "Rafael J. Wysocki" <rafael@kernel.org> - 2017-03-17 17:40 +0100
Re: [PATCH] cpufreq: Restore policy min/max limits on CPU online Viresh Kumar <viresh.kumar@linaro.org> - 2017-03-17 18:00 +0100
Re: [PATCH] cpufreq: Restore policy min/max limits on CPU online "Rafael J. Wysocki" <rafael@kernel.org> - 2017-03-17 18:50 +0100
Re: [PATCH] cpufreq: Restore policy min/max limits on CPU online Viresh Kumar <viresh.kumar@linaro.org> - 2017-03-20 04:30 +0100
Re: [PATCH] cpufreq: Restore policy min/max limits on CPU online "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-03-20 13:50 +0100
[PATCH v2] cpufreq: Restore policy min/max limits on CPU online "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-03-17 19:00 +0100
csiph-web