From: Christian Krafft <krafft@de.ibm.com>
To: Christian Krafft <krafft@de.ibm.com>
Cc: "linuxppc-dev@ozlabs.org" <linuxppc-dev@ozlabs.org>,
"cbe-oss-dev@ozlabs.org" <cbe-oss-dev@ozlabs.org>
Subject: [patch 2/5] cell: cbe_cpufreq fix latency measurement
Date: Thu, 21 Jun 2007 13:20:52 +0200 [thread overview]
Message-ID: <20070621132052.3048e0ec@localhost> (raw)
In-Reply-To: <20070621130944.083f8fa5@localhost>
[-- Attachment #1.1: Type: text/plain, Size: 2929 bytes --]
From: Christian Krafft <krafft@de.ibm.com>
This patch fixes the debug code that calculates the transition time when
changing the slow modes on a Cell BE cpu.
Singed-off-by: Christian Krafft <krafft@de.ibm.com>
Index: linux/arch/powerpc/platforms/cell/cbe_cpufreq.c
===================================================================
--- linux.orig/arch/powerpc/platforms/cell/cbe_cpufreq.c
+++ linux/arch/powerpc/platforms/cell/cbe_cpufreq.c
@@ -81,7 +81,7 @@ static int set_pmode_pmi(int cpu, unsign
int ret;
pmi_message_t pmi_msg;
#ifdef DEBUG
- u64 time;
+ long time;
#endif
pmi_msg.type = PMI_TYPE_FREQ_CHANGE;
@@ -89,7 +89,7 @@ static int set_pmode_pmi(int cpu, unsign
pmi_msg.data2 = pmode;
#ifdef DEBUG
- time = (u64) get_cycles();
+ time = jiffies;
#endif
pmi_send_message(pmi_msg);
@@ -98,9 +98,9 @@ static int set_pmode_pmi(int cpu, unsign
pr_debug("PMI returned slow mode %d\n", ret);
#ifdef DEBUG
- time = (u64) get_cycles() - time; /* actual cycles (not cpu cycles!) */
- time = 1000000000 * time / CLOCK_TICK_RATE; /* time in ns (10^-9) */
- pr_debug("had to wait %lu ns for a transition\n", time);
+ time = jiffies - time; /* actual cycles (not cpu cycles!) */
+ time = jiffies_to_msecs(time);
+ pr_debug("had to wait %lu ms for a transition using PMI.\n", time);
#endif
return ret;
}
@@ -123,15 +123,18 @@ static int set_pmode_reg(int cpu, unsign
struct cbe_mic_tm_regs __iomem *mic_tm_regs;
u64 flags;
u64 value;
+#ifdef DEBUG
+ long time;
+#endif
local_irq_save(flags);
mic_tm_regs = cbe_get_cpu_mic_tm_regs(cpu);
pmd_regs = cbe_get_cpu_pmd_regs(cpu);
- pr_debug("pm register is mapped at %p\n", &pmd_regs->pmcr);
- pr_debug("mic register is mapped at %p\n", &mic_tm_regs->slow_fast_timer_0);
-
+#ifdef DEBUG
+ time = jiffies;
+#endif
out_be64(&mic_tm_regs->slow_fast_timer_0, MIC_Slow_Fast_Timer_table[pmode]);
out_be64(&mic_tm_regs->slow_fast_timer_1, MIC_Slow_Fast_Timer_table[pmode]);
@@ -146,6 +149,7 @@ static int set_pmode_reg(int cpu, unsign
out_be64(&pmd_regs->pmcr, value);
+#ifdef DEBUG
/* wait until new pmode appears in status register */
value = in_be64(&pmd_regs->pmsr) & 0x07;
while(value != pmode) {
@@ -153,6 +157,11 @@ static int set_pmode_reg(int cpu, unsign
value = in_be64(&pmd_regs->pmsr) & 0x07;
}
+ time = jiffies - time;
+ time = jiffies_to_msecs(time);
+ pr_debug("had to wait %lu ms for a transition using " \
+ "the pervasive unit.\n", time);
+#endif
local_irq_restore(flags);
return 0;
--
Mit freundlichen Gruessen,
kind regards,
Christian Krafft
IBM Systems & Technology Group,
Linux Kernel Development
IT Specialist
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschaeftsfuehrung: Herbert Kircher
Sitz der Gesellschaft: Boeblingen
Registriergericht: Amtsgericht Stuttgart, HRB 243294
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: cbe_cpufreq-fix-latency-measurement.diff --]
[-- Type: text/x-patch; name=cbe_cpufreq-fix-latency-measurement.diff, Size: 2655 bytes --]
Subject: cell: cbe_cpufreq fix latency measurement
From: Christian Krafft <krafft@de.ibm.com>
This patch fixes the debug code that calculates the transition time when
changing the slow modes on a Cell BE cpu.
Singed-off-by: Christian Krafft <krafft@de.ibm.com>
Index: linux/arch/powerpc/platforms/cell/cbe_cpufreq.c
===================================================================
--- linux.orig/arch/powerpc/platforms/cell/cbe_cpufreq.c
+++ linux/arch/powerpc/platforms/cell/cbe_cpufreq.c
@@ -81,7 +81,7 @@ static int set_pmode_pmi(int cpu, unsign
int ret;
pmi_message_t pmi_msg;
#ifdef DEBUG
- u64 time;
+ long time;
#endif
pmi_msg.type = PMI_TYPE_FREQ_CHANGE;
@@ -89,7 +89,7 @@ static int set_pmode_pmi(int cpu, unsign
pmi_msg.data2 = pmode;
#ifdef DEBUG
- time = (u64) get_cycles();
+ time = jiffies;
#endif
pmi_send_message(pmi_msg);
@@ -98,9 +98,9 @@ static int set_pmode_pmi(int cpu, unsign
pr_debug("PMI returned slow mode %d\n", ret);
#ifdef DEBUG
- time = (u64) get_cycles() - time; /* actual cycles (not cpu cycles!) */
- time = 1000000000 * time / CLOCK_TICK_RATE; /* time in ns (10^-9) */
- pr_debug("had to wait %lu ns for a transition\n", time);
+ time = jiffies - time; /* actual cycles (not cpu cycles!) */
+ time = jiffies_to_msecs(time);
+ pr_debug("had to wait %lu ms for a transition using PMI.\n", time);
#endif
return ret;
}
@@ -123,15 +123,18 @@ static int set_pmode_reg(int cpu, unsign
struct cbe_mic_tm_regs __iomem *mic_tm_regs;
u64 flags;
u64 value;
+#ifdef DEBUG
+ long time;
+#endif
local_irq_save(flags);
mic_tm_regs = cbe_get_cpu_mic_tm_regs(cpu);
pmd_regs = cbe_get_cpu_pmd_regs(cpu);
- pr_debug("pm register is mapped at %p\n", &pmd_regs->pmcr);
- pr_debug("mic register is mapped at %p\n", &mic_tm_regs->slow_fast_timer_0);
-
+#ifdef DEBUG
+ time = jiffies;
+#endif
out_be64(&mic_tm_regs->slow_fast_timer_0, MIC_Slow_Fast_Timer_table[pmode]);
out_be64(&mic_tm_regs->slow_fast_timer_1, MIC_Slow_Fast_Timer_table[pmode]);
@@ -146,6 +149,7 @@ static int set_pmode_reg(int cpu, unsign
out_be64(&pmd_regs->pmcr, value);
+#ifdef DEBUG
/* wait until new pmode appears in status register */
value = in_be64(&pmd_regs->pmsr) & 0x07;
while(value != pmode) {
@@ -153,6 +157,11 @@ static int set_pmode_reg(int cpu, unsign
value = in_be64(&pmd_regs->pmsr) & 0x07;
}
+ time = jiffies - time;
+ time = jiffies_to_msecs(time);
+ pr_debug("had to wait %lu ms for a transition using " \
+ "the pervasive unit.\n", time);
+#endif
local_irq_restore(flags);
return 0;
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2007-06-21 11:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-21 11:09 [patch 0/5] cell: cpufreq and pmi patches Christian Krafft
2007-06-21 11:16 ` [patch 1/5] cell: pmi remove support for mutiple devices Christian Krafft
2007-06-21 14:07 ` [Cbe-oss-dev] " Akinobu Mita
2007-06-22 14:10 ` Christian Krafft
2007-06-25 1:44 ` Akinobu Mita
2007-06-22 16:00 ` Resend: " Christian Krafft
2007-06-21 11:20 ` Christian Krafft [this message]
2007-06-21 11:23 ` [patch 3/5] cell: cbe_cpufreq: fix initialization Christian Krafft
2007-06-21 11:26 ` [patch 4/5] cell: cpufreq and pmi patches Christian Krafft
2007-06-21 11:41 ` [patch 5/5] cell: cbe_cpufreq: reorganize code Christian Krafft
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=20070621132052.3048e0ec@localhost \
--to=krafft@de.ibm.com \
--cc=cbe-oss-dev@ozlabs.org \
--cc=linuxppc-dev@ozlabs.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;
as well as URLs for NNTP newsgroup(s).