From: Viresh Kumar <viresh.kumar@linaro.org>
To: rjw@rjwysocki.net
Cc: linaro-kernel@lists.linaro.org, cpufreq@vger.kernel.org,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
xin.wang@arm.com, arvind.chauhan@arm.com, Sudeep.Holla@arm.com,
Viresh Kumar <viresh.kumar@linaro.org>
Subject: [PATCH 2/2] cpufreq: arm_big_little: set 'physical_cluster' for each cpu
Date: Fri, 14 Mar 2014 12:10:55 +0530 [thread overview]
Message-ID: <354da516ba1facd6764bfc416ef13a59f9681d1c.1394779110.git.viresh.kumar@linaro.org> (raw)
In-Reply-To: <4689064c920e08d5667b38d7117620ab98150273.1394779110.git.viresh.kumar@linaro.org>
In-Reply-To: <4689064c920e08d5667b38d7117620ab98150273.1394779110.git.viresh.kumar@linaro.org>
We have a per-cpu variable for managing which cluster does a CPU belong to.
Currently physical_cluster is set only for the policy->cpu. And that results in
following on some SoC's:
- There are two clusters:
- Cluster 0 has four ARM Cortex A7 CPUs (slower ones): 0,1,2,3
- Cluster 1 has four ARM Cortex A15 CPUs (faster ones): 4,5,6,7
- CPUs are booted in order 0,1..7 and so initially policy->cpu for A7 cluster
would be 0 and for A15 cluster would be 4.
- Now CPU4 (i.e. A15_0) is hotplugged out and so policy->cpu for A15 cluster
becomes 5 (i.e. A15_1).
- But physical cluster is only set for CPU0 and CPU4 in ARM big LITTLE driver
and isn't updated.
- Now freq change request comes for A15 cluster and we would try to update freq
of physical_cluster of CPU5, i.e. A15_1. And it is currently set to zero
(default value of uninitialized global variables).
- And so we actually try to change freq of A7 cluster instead of A15.
- This also results in kernel crash as sometimes we might request freq above
A7's limit and CPU may behave badly..
Fix this by initializing physical_cluster for all CPUs of a policy.
(Adding signed-off by Xin as he reported this issue and provided this diff)
Signed-off-by: Xin Wang <xin.wang@arm.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/cpufreq/arm_big_little.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c
index 3d87078..bad2ed3 100644
--- a/drivers/cpufreq/arm_big_little.c
+++ b/drivers/cpufreq/arm_big_little.c
@@ -446,9 +446,12 @@ static int bL_cpufreq_init(struct cpufreq_policy *policy)
}
if (cur_cluster < MAX_CLUSTERS) {
+ int cpu;
+
cpumask_copy(policy->cpus, topology_core_cpumask(policy->cpu));
- per_cpu(physical_cluster, policy->cpu) = cur_cluster;
+ for_each_cpu(cpu, policy->cpus)
+ per_cpu(physical_cluster, cpu) = cur_cluster;
} else {
/* Assumption: during init, we are always running on A15 */
per_cpu(physical_cluster, policy->cpu) = A15_CLUSTER;
--
1.7.12.rc2.18.g61b472e
next prev parent reply other threads:[~2014-03-14 6:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-14 6:40 [PATCH 1/2] cpufreq: arm_big_little: make vexpress driver dependent on bL core driver Viresh Kumar
2014-03-14 6:40 ` Viresh Kumar [this message]
2014-03-14 12:34 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=354da516ba1facd6764bfc416ef13a59f9681d1c.1394779110.git.viresh.kumar@linaro.org \
--to=viresh.kumar@linaro.org \
--cc=Sudeep.Holla@arm.com \
--cc=arvind.chauhan@arm.com \
--cc=cpufreq@vger.kernel.org \
--cc=linaro-kernel@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=xin.wang@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).