diff options
author | Jeff Dike <jdike@addtoit.com> | 2007-02-10 04:44:12 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-11 13:51:22 -0500 |
commit | 490ba1714b31a131cdc6318231aa227d19bf0761 (patch) | |
tree | e00ccf9e10d0cbcc49efb0c09c699ae25dd4efea /arch | |
parent | c0961c1804c46bf5bb253e1bd6bc93e4627b79a1 (diff) |
[PATCH] uml: make time data per-cpu
prev_nsecs and delta need to be arrays, and indexed by CPU number.
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/um/kernel/time.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c index 2e354b3ca060..b1f8b0752419 100644 --- a/arch/um/kernel/time.c +++ b/arch/um/kernel/time.c | |||
@@ -35,31 +35,31 @@ unsigned long long sched_clock(void) | |||
35 | return (unsigned long long)jiffies_64 * (1000000000 / HZ); | 35 | return (unsigned long long)jiffies_64 * (1000000000 / HZ); |
36 | } | 36 | } |
37 | 37 | ||
38 | static unsigned long long prev_nsecs; | 38 | static unsigned long long prev_nsecs[NR_CPUS]; |
39 | #ifdef CONFIG_UML_REAL_TIME_CLOCK | 39 | #ifdef CONFIG_UML_REAL_TIME_CLOCK |
40 | static long long delta; /* Deviation per interval */ | 40 | static long long delta[NR_CPUS]; /* Deviation per interval */ |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | void timer_irq(union uml_pt_regs *regs) | 43 | void timer_irq(union uml_pt_regs *regs) |
44 | { | 44 | { |
45 | unsigned long long ticks = 0; | 45 | unsigned long long ticks = 0; |
46 | |||
47 | #ifdef CONFIG_UML_REAL_TIME_CLOCK | 46 | #ifdef CONFIG_UML_REAL_TIME_CLOCK |
48 | if(prev_nsecs){ | 47 | int c = cpu(); |
48 | if(prev_nsecs[c]){ | ||
49 | /* We've had 1 tick */ | 49 | /* We've had 1 tick */ |
50 | unsigned long long nsecs = os_nsecs(); | 50 | unsigned long long nsecs = os_nsecs(); |
51 | 51 | ||
52 | delta += nsecs - prev_nsecs; | 52 | delta[c] += nsecs - prev_nsecs[c]; |
53 | prev_nsecs = nsecs; | 53 | prev_nsecs[c] = nsecs; |
54 | 54 | ||
55 | /* Protect against the host clock being set backwards */ | 55 | /* Protect against the host clock being set backwards */ |
56 | if(delta < 0) | 56 | if(delta[c] < 0) |
57 | delta = 0; | 57 | delta[c] = 0; |
58 | 58 | ||
59 | ticks += (delta * HZ) / BILLION; | 59 | ticks += (delta[c] * HZ) / BILLION; |
60 | delta -= (ticks * BILLION) / HZ; | 60 | delta[c] -= (ticks * BILLION) / HZ; |
61 | } | 61 | } |
62 | else prev_nsecs = os_nsecs(); | 62 | else prev_nsecs[c] = os_nsecs(); |
63 | #else | 63 | #else |
64 | ticks = 1; | 64 | ticks = 1; |
65 | #endif | 65 | #endif |
@@ -69,8 +69,8 @@ void timer_irq(union uml_pt_regs *regs) | |||
69 | } | 69 | } |
70 | } | 70 | } |
71 | 71 | ||
72 | /* Protects local_offset */ | ||
72 | static DEFINE_SPINLOCK(timer_spinlock); | 73 | static DEFINE_SPINLOCK(timer_spinlock); |
73 | |||
74 | static unsigned long long local_offset = 0; | 74 | static unsigned long long local_offset = 0; |
75 | 75 | ||
76 | static inline unsigned long long get_time(void) | 76 | static inline unsigned long long get_time(void) |