From: Sanjeev Premi <premi@ti.com>
To: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Cc: Sanjeev Premi <premi@ti.com>
Subject: [PATCHv2] omap2+: pm: cpufreq: Fix loops_per_jiffy calculation
Date: Fri, 24 Jun 2011 19:23:38 +0530 [thread overview]
Message-ID: <1308923618-5333-1-git-send-email-premi@ti.com> (raw)
Currently, loops_per_jiffy is being calculated twice for
non-SMP processors.
- Before calling cpufreq_notify_transition()
- From within cpufreq_notify_transition()
Double adjustment leads to incorrect value being assigned to
loops_per_jiffy. This manifests as incorrect BogoMIPS in
"cat /proc/cpuinfo".
The value of loops_per_jiffy needs to be calculated only
when CONFIG_SMP is true. It is the core change included
in this patch.
The patch also leverages the definition of for_each_cpu()
with and without CONFIG_SMP to consolidate the mechanism
to call cpufreq_notify_transition().
Signed-off-by: Sanjeev Premi <premi@ti.com>
---
Changes since v1:
* loops_per_jiffy are updated when CONFIG_SMP is true.
* leverage definition of for_each_cpu()
Tested on OMAP3EVM with and without CONFIG_SMP.
Since the log is rather long, will be posting the log in
a follow-up mail.
arch/arm/mach-omap2/omap2plus-cpufreq.c | 27 +++++++++++++++------------
1 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/arch/arm/mach-omap2/omap2plus-cpufreq.c b/arch/arm/mach-omap2/omap2plus-cpufreq.c
index 346519e..0263cae 100644
--- a/arch/arm/mach-omap2/omap2plus-cpufreq.c
+++ b/arch/arm/mach-omap2/omap2plus-cpufreq.c
@@ -97,12 +97,8 @@ static int omap_target(struct cpufreq_policy *policy,
return ret;
/* Notify transitions */
- if (is_smp()) {
- for_each_cpu(i, policy->cpus) {
- freqs.cpu = i;
- cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
- }
- } else {
+ for_each_cpu(i, policy->cpus) {
+ freqs.cpu = i;
cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
}
@@ -114,13 +110,20 @@ static int omap_target(struct cpufreq_policy *policy,
freqs.new = omap_getspeed(policy->cpu);
+#ifdef CONFIG_SMP
+ /* Adjust jiffies before transition */
+ for_each_cpu(i, policy->cpus) {
+ unsigned long lpj = per_cpu(cpu_data, i).loops_per_jiffy;
+
+ per_cpu(cpu_data, i).loops_per_jiffy = cpufreq_scale(lpj,
+ freqs.old,
+ freqs.new);
+ }
+#endif
+
/* Notify transitions */
- if (is_smp()) {
- for_each_cpu(i, policy->cpus) {
- freqs.cpu = i;
- cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
- }
- } else {
+ for_each_cpu(i, policy->cpus) {
+ freqs.cpu = i;
cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
}
--
1.7.2.2
next reply other threads:[~2011-06-24 13:53 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-24 13:53 Sanjeev Premi [this message]
2011-06-24 13:59 ` [PATCHv2] omap2+: pm: cpufreq: Fix loops_per_jiffy calculation Premi, Sanjeev
2011-06-24 14:01 ` Russell King - ARM Linux
2011-06-24 14:09 ` Premi, Sanjeev
2011-06-24 14:14 ` Russell King - ARM Linux
2011-06-24 15:12 ` Russell King - ARM Linux
2011-06-24 15:34 ` Premi, Sanjeev
2011-06-24 17:50 ` Premi, Sanjeev
2011-06-24 18:51 ` Russell King - ARM Linux
2011-06-24 20:14 ` Kevin Hilman
2011-06-25 16:20 ` Premi, Sanjeev
2011-06-24 18:48 ` Santosh Shilimkar
2011-06-25 18:53 ` Premi, Sanjeev
2011-06-25 19:09 ` Russell King - ARM Linux
2011-06-27 4:54 ` Premi, Sanjeev
2011-06-27 7:40 ` Russell King - ARM Linux
2011-06-24 14:35 ` Santosh Shilimkar
2011-06-24 14:40 ` Premi, Sanjeev
2011-06-24 14:47 ` Santosh Shilimkar
2011-06-28 22:29 ` Colin Cross
2011-06-28 22:45 ` Santosh Shilimkar
2011-06-28 22:56 ` Colin Cross
[not found] ` <CAMbhsRRctHC2wSi7cWjO2Fn_rM7=dMtTrt6PbsVehrgx9SKwzw@mail.gmail.com>
2011-06-28 23:00 ` Santosh Shilimkar
2011-06-28 23:04 ` Santosh Shilimkar
2011-06-28 23:03 ` Russell King - ARM Linux
2011-06-28 23:07 ` Santosh Shilimkar
2011-06-28 22:55 ` Russell King - ARM Linux
2011-06-28 22:58 ` Colin Cross
2011-06-28 23:17 ` Russell King - ARM Linux
2011-06-28 23:37 ` Colin Cross
2011-06-28 23:46 ` Russell King - ARM Linux
2011-06-28 23:59 ` Colin Cross
2011-06-29 14:00 ` Russell King - ARM Linux
2011-06-29 16:57 ` Colin Cross
2011-06-29 18:29 ` Stephen Boyd
2011-06-29 18:43 ` Russell King - ARM Linux
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=1308923618-5333-1-git-send-email-premi@ti.com \
--to=premi@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-omap@vger.kernel.org \
/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