diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2013-07-02 16:36:28 +0530 |
---|---|---|
committer | Marek Szyprowski <m.szyprowski@samsung.com> | 2014-04-01 13:07:34 +0200 |
commit | 56e69b35155ea6b699c6dba228aae5521fa8d4a2 (patch) | |
tree | 7882c48df18534160c19e18bbfca9dbb7bd3e790 | |
parent | f561427a7dbfd94e20b69e062d4b1c0ffc93d996 (diff) | |
download | linux-3.10-56e69b35155ea6b699c6dba228aae5521fa8d4a2.tar.gz linux-3.10-56e69b35155ea6b699c6dba228aae5521fa8d4a2.tar.bz2 linux-3.10-56e69b35155ea6b699c6dba228aae5521fa8d4a2.zip |
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.
Change-Id: I5712dde7f992644f9c3ddc8313151f80bea0d877
Reported-and-tested-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 7 | ||||
-rw-r--r-- | include/linux/cpufreq.h | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 00050b057cb..398882939cb 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -266,11 +266,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 @@ -295,7 +296,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, diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index e3da73bbcf0..bd1ad374076 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -121,7 +121,7 @@ struct cpufreq_policy { struct list_head policy_list; struct kobject kobj; struct completion kobj_unregister; - bool transition_ongoing; /* Tracks transition status */ + int transition_ongoing; /* Tracks transition status */ }; #define CPUFREQ_ADJUST (0) |