Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[CELL] cbe_cpufreq: fix latency measurement

This patch fixes the debug code that calculates the transition time when
changing the slow modes on a Cell BE cpu.

Signed-off-by: Christian Krafft <krafft@de.ibm.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>

authored by

Christian Krafft and committed by
Arnd Bergmann
a964b9be 813f9072

+17 -8
+17 -8
arch/powerpc/platforms/cell/cbe_cpufreq.c
··· 81 81 int ret; 82 82 pmi_message_t pmi_msg; 83 83 #ifdef DEBUG 84 - u64 time; 84 + long time; 85 85 #endif 86 86 87 87 pmi_msg.type = PMI_TYPE_FREQ_CHANGE; ··· 89 89 pmi_msg.data2 = pmode; 90 90 91 91 #ifdef DEBUG 92 - time = (u64) get_cycles(); 92 + time = jiffies; 93 93 #endif 94 94 95 95 pmi_send_message(pmi_msg); ··· 98 98 pr_debug("PMI returned slow mode %d\n", ret); 99 99 100 100 #ifdef DEBUG 101 - time = (u64) get_cycles() - time; /* actual cycles (not cpu cycles!) */ 102 - time = 1000000000 * time / CLOCK_TICK_RATE; /* time in ns (10^-9) */ 103 - pr_debug("had to wait %lu ns for a transition\n", time); 101 + time = jiffies - time; /* actual cycles (not cpu cycles!) */ 102 + time = jiffies_to_msecs(time); 103 + pr_debug("had to wait %lu ms for a transition using PMI.\n", time); 104 104 #endif 105 105 return ret; 106 106 } ··· 123 123 struct cbe_mic_tm_regs __iomem *mic_tm_regs; 124 124 u64 flags; 125 125 u64 value; 126 + #ifdef DEBUG 127 + long time; 128 + #endif 126 129 127 130 local_irq_save(flags); 128 131 129 132 mic_tm_regs = cbe_get_cpu_mic_tm_regs(cpu); 130 133 pmd_regs = cbe_get_cpu_pmd_regs(cpu); 131 134 132 - pr_debug("pm register is mapped at %p\n", &pmd_regs->pmcr); 133 - pr_debug("mic register is mapped at %p\n", &mic_tm_regs->slow_fast_timer_0); 134 - 135 + #ifdef DEBUG 136 + time = jiffies; 137 + #endif 135 138 out_be64(&mic_tm_regs->slow_fast_timer_0, MIC_Slow_Fast_Timer_table[pmode]); 136 139 out_be64(&mic_tm_regs->slow_fast_timer_1, MIC_Slow_Fast_Timer_table[pmode]); 137 140 ··· 149 146 150 147 out_be64(&pmd_regs->pmcr, value); 151 148 149 + #ifdef DEBUG 152 150 /* wait until new pmode appears in status register */ 153 151 value = in_be64(&pmd_regs->pmsr) & 0x07; 154 152 while(value != pmode) { ··· 157 153 value = in_be64(&pmd_regs->pmsr) & 0x07; 158 154 } 159 155 156 + time = jiffies - time; 157 + time = jiffies_to_msecs(time); 158 + pr_debug("had to wait %lu ms for a transition using " \ 159 + "the pervasive unit.\n", time); 160 + #endif 160 161 local_irq_restore(flags); 161 162 162 163 return 0;