Re: [PATCH] cpufreq: Fix runtime warnings on systems with shared core clocks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2 July 2013 05:47, Mark Brown <broonie@xxxxxxxxxx> wrote:
> I'll try to have a look at doing the code motion fix tomorrow if that's
> more suitable, the check seems like a good idea and looking at the code
> it's probably sensible to factor out more of the changes.

So sorry for this, The time I tried it, was booting it with only one cpu
per cluster for some reason :(

Please see if below fixes it for you. Use attached patch for testing it.

------x------------------x-------------

From: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
Date: Tue, 2 Jul 2013 10:41:54 +0530
Subject: [PATCH] cpufreq: Fix serialization of frequency transitions

Commit 7c30ed ("cpufreq: make sure frequency transitions are serialized")
interacts poorly with systems that have a single core freqency for all
cores.  On such systems we have a single policy for all cores with
several CPUs.  When we do a frequency transition the governor calls the
pre and post change notifiers which causes cpufreq_notify_transition()
per CPU.  Since the policy is the same for all of them all CPUs after
the first and the warnings added are generated by checking a per-policy
flag the warnings will be triggered for all cores after the first.

Fix this by allowing notifier to be called for n times. Where n is the number of
cpus in policy->cpus.

Reported-by: Mark Brown <broonie@xxxxxxxxxx>
Signed-off-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
---
 drivers/cpufreq/cpufreq.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 75715f1..438dcee 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -264,11 +264,12 @@ void __cpufreq_notify_transition(struct
cpufreq_policy *policy,
 	switch (state) {

 	case CPUFREQ_PRECHANGE:
-		if (WARN(policy->transition_ongoing,
+		if (WARN(policy->transition_ongoing ==
+					cpumask_weight(policy->cpus),
 				"In middle of another frequency transition\n"))
 			return;

-		policy->transition_ongoing = true;
+		policy->transition_ongoing++;

 		/* detect if the driver reported a value as "old frequency"
 		 * which is not equal to what the cpufreq core thinks is
@@ -293,7 +294,7 @@ void __cpufreq_notify_transition(struct
cpufreq_policy *policy,
 				"No frequency transition in progress\n"))
 			return;

-		policy->transition_ongoing = false;
+		policy->transition_ongoing--;

 		adjust_jiffies(CPUFREQ_POSTCHANGE, freqs);
 		pr_debug("FREQ: %lu - CPU: %lu", (unsigned long)freqs->new,

Attachment: 0001-cpufreq-Fix-serialization-of-frequency-transitions.patch
Description: Binary data


[Index of Archives]     [Linux Kernel Devel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Forum]     [Linux SCSI]

  Powered by Linux