提交 266c13d7 编写于 作者: V Viresh Kumar 提交者: Rafael J. Wysocki

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-and-tested-by: NMark Brown <broonie@linaro.org>
Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
上级 f991fae5
...@@ -312,11 +312,12 @@ static void __cpufreq_notify_transition(struct cpufreq_policy *policy, ...@@ -312,11 +312,12 @@ static void __cpufreq_notify_transition(struct cpufreq_policy *policy,
switch (state) { switch (state) {
case CPUFREQ_PRECHANGE: case CPUFREQ_PRECHANGE:
if (WARN(policy->transition_ongoing, if (WARN(policy->transition_ongoing ==
cpumask_weight(policy->cpus),
"In middle of another frequency transition\n")) "In middle of another frequency transition\n"))
return; return;
policy->transition_ongoing = true; policy->transition_ongoing++;
/* detect if the driver reported a value as "old frequency" /* detect if the driver reported a value as "old frequency"
* which is not equal to what the cpufreq core thinks is * which is not equal to what the cpufreq core thinks is
...@@ -341,7 +342,7 @@ static void __cpufreq_notify_transition(struct cpufreq_policy *policy, ...@@ -341,7 +342,7 @@ static void __cpufreq_notify_transition(struct cpufreq_policy *policy,
"No frequency transition in progress\n")) "No frequency transition in progress\n"))
return; return;
policy->transition_ongoing = false; policy->transition_ongoing--;
adjust_jiffies(CPUFREQ_POSTCHANGE, freqs); adjust_jiffies(CPUFREQ_POSTCHANGE, freqs);
pr_debug("FREQ: %lu - CPU: %lu", (unsigned long)freqs->new, pr_debug("FREQ: %lu - CPU: %lu", (unsigned long)freqs->new,
......
...@@ -119,7 +119,7 @@ struct cpufreq_policy { ...@@ -119,7 +119,7 @@ struct cpufreq_policy {
struct kobject kobj; struct kobject kobj;
struct completion kobj_unregister; struct completion kobj_unregister;
bool transition_ongoing; /* Tracks transition status */ int transition_ongoing; /* Tracks transition status */
}; };
#define CPUFREQ_ADJUST (0) #define CPUFREQ_ADJUST (0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册