Skip to contentSkip to conversation

Patch "cpufreq: Restore policy min/max limits on CPU online" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Mar 28, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

cpufreq: Restore policy min/max limits on CPU online

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
cpufreq-restore-policy-min-max-limits-on-cpu-online.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From ff010472fb75670cb5c08671e820eeea3af59c87 Mon Sep 17 00:00:00 2001

From: Viresh Kumar <[email protected]>
Date: Tue, 21 Mar 2017 11:36:06 +0530
Subject: cpufreq: Restore policy min/max limits on CPU online

From: Viresh Kumar <[email protected]>

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.

---
 drivers/cpufreq/cpufreq.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/cpufreq/cpufreq.c +3 -0
@@ -1190,6 +1190,9 @@ static int cpufreq_online(unsigned int c
 		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) {

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/cpufreq-restore-policy-min-max-limits-on-cpu-online.patch