From: Viresh Kumar Date: Tue, 21 Mar 2017 06:06:06 +0000 (+0530) Subject: cpufreq: Restore policy min/max limits on CPU online X-Git-Tag: Ubuntu-4.10.0-16.18~22 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=04e72fb5739e8d9d433b17333274f195625a9ab5;p=mirror_ubuntu-zesty-kernel.git cpufreq: Restore policy min/max limits on CPU online BugLink: http://bugs.launchpad.net/bugs/1677589 commit ff010472fb75670cb5c08671e820eeea3af59c87 upstream. 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_online() restore the limits when an inactive policy is brought online. The commit log and patch are inspired from Rafael's earlier work. Reported-by: Rafael J. Wysocki Signed-off-by: Viresh Kumar Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman Signed-off-by: Tim Gardner --- diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 5f7585c1712f..6f8a1690ab91 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1190,6 +1190,9 @@ static int cpufreq_online(unsigned int cpu) for_each_cpu(j, policy->related_cpus) per_cpu(cpufreq_cpu_data, j) = policy; write_unlock_irqrestore(&cpufreq_driver_lock, flags); + } else { + policy->min = policy->user_policy.min; + policy->max = policy->user_policy.max; } if (cpufreq_driver->get && !cpufreq_driver->setpolicy) {