summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0085-powerpc-Fix-wrong-divisor-in-usecs_to_cputime.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0085-powerpc-Fix-wrong-divisor-in-usecs_to_cputime.patch')
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0085-powerpc-Fix-wrong-divisor-in-usecs_to_cputime.patch87
1 files changed, 87 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0085-powerpc-Fix-wrong-divisor-in-usecs_to_cputime.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0085-powerpc-Fix-wrong-divisor-in-usecs_to_cputime.patch
new file mode 100644
index 00000000..eb4249f4
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0085-powerpc-Fix-wrong-divisor-in-usecs_to_cputime.patch
@@ -0,0 +1,87 @@
1From ec9436c865d11ebd0fd6909a9ef2a63e5536ff29 Mon Sep 17 00:00:00 2001
2From: Andreas Schwab <schwab@linux-m68k.org>
3Date: Fri, 9 Dec 2011 11:35:08 +0000
4Subject: [PATCH 085/109] powerpc: Fix wrong divisor in usecs_to_cputime
5
6commit 9f5072d4f63f28d30d343573830ac6c85fc0deff upstream.
7
8Commit d57af9b (taskstats: use real microsecond granularity for CPU times)
9renamed msecs_to_cputime to usecs_to_cputime, but failed to update all
10numbers on the way. This causes nonsensical cpu idle/iowait values to be
11displayed in /proc/stat (the only user of usecs_to_cputime so far).
12
13This also renames __cputime_msec_factor to __cputime_usec_factor, adapting
14its value and using it directly in cputime_to_usecs instead of doing two
15multiplications.
16
17Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
18Acked-by: Anton Blanchard <anton@samba.org>
19Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
20Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
21---
22 arch/powerpc/include/asm/cputime.h | 6 +++---
23 arch/powerpc/kernel/time.c | 10 +++++-----
24 2 files changed, 8 insertions(+), 8 deletions(-)
25
26diff --git a/arch/powerpc/include/asm/cputime.h b/arch/powerpc/include/asm/cputime.h
27index 98b7c4b..fa3f921 100644
28--- a/arch/powerpc/include/asm/cputime.h
29+++ b/arch/powerpc/include/asm/cputime.h
30@@ -126,11 +126,11 @@ static inline u64 cputime64_to_jiffies64(const cputime_t ct)
31 /*
32 * Convert cputime <-> microseconds
33 */
34-extern u64 __cputime_msec_factor;
35+extern u64 __cputime_usec_factor;
36
37 static inline unsigned long cputime_to_usecs(const cputime_t ct)
38 {
39- return mulhdu(ct, __cputime_msec_factor) * USEC_PER_MSEC;
40+ return mulhdu(ct, __cputime_usec_factor);
41 }
42
43 static inline cputime_t usecs_to_cputime(const unsigned long us)
44@@ -143,7 +143,7 @@ static inline cputime_t usecs_to_cputime(const unsigned long us)
45 sec = us / 1000000;
46 if (ct) {
47 ct *= tb_ticks_per_sec;
48- do_div(ct, 1000);
49+ do_div(ct, 1000000);
50 }
51 if (sec)
52 ct += (cputime_t) sec * tb_ticks_per_sec;
53diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
54index 5db163c..ec8affe 100644
55--- a/arch/powerpc/kernel/time.c
56+++ b/arch/powerpc/kernel/time.c
57@@ -168,13 +168,13 @@ EXPORT_SYMBOL_GPL(ppc_tb_freq);
58 #ifdef CONFIG_VIRT_CPU_ACCOUNTING
59 /*
60 * Factors for converting from cputime_t (timebase ticks) to
61- * jiffies, milliseconds, seconds, and clock_t (1/USER_HZ seconds).
62+ * jiffies, microseconds, seconds, and clock_t (1/USER_HZ seconds).
63 * These are all stored as 0.64 fixed-point binary fractions.
64 */
65 u64 __cputime_jiffies_factor;
66 EXPORT_SYMBOL(__cputime_jiffies_factor);
67-u64 __cputime_msec_factor;
68-EXPORT_SYMBOL(__cputime_msec_factor);
69+u64 __cputime_usec_factor;
70+EXPORT_SYMBOL(__cputime_usec_factor);
71 u64 __cputime_sec_factor;
72 EXPORT_SYMBOL(__cputime_sec_factor);
73 u64 __cputime_clockt_factor;
74@@ -192,8 +192,8 @@ static void calc_cputime_factors(void)
75
76 div128_by_32(HZ, 0, tb_ticks_per_sec, &res);
77 __cputime_jiffies_factor = res.result_low;
78- div128_by_32(1000, 0, tb_ticks_per_sec, &res);
79- __cputime_msec_factor = res.result_low;
80+ div128_by_32(1000000, 0, tb_ticks_per_sec, &res);
81+ __cputime_usec_factor = res.result_low;
82 div128_by_32(1, 0, tb_ticks_per_sec, &res);
83 __cputime_sec_factor = res.result_low;
84 div128_by_32(USER_HZ, 0, tb_ticks_per_sec, &res);
85--
861.7.7.6
87