diff options
author | Ingo Molnar <mingo@elte.hu> | 2007-02-16 04:27:34 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-16 11:13:57 -0500 |
commit | 95492e4646e5de8b43d9a7908d6177fb737b61f0 (patch) | |
tree | ae25cd206ca76f78d50ac2a206ef012e0ab1d9df /include/asm-x86_64/timex.h | |
parent | 92c7e00254b2d0efc1e36ac3e45474ce1871b6b2 (diff) |
[PATCH] x86: rewrite SMP TSC sync code
make the TSC synchronization code more robust, and unify it between x86_64 and
i386.
The biggest change is the removal of the 'fix up TSCs' code on x86_64 and
i386, in some rare cases it was /causing/ time-warps on SMP systems.
The new code only checks for TSC asynchronity - and if it can prove a
time-warp (if it can observe the TSC going backwards when going from one CPU
to another within a critical section), then the TSC clock-source is turned
off.
The TSC synchronization-checking code also got moved into a separate file.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: john stultz <johnstul@us.ibm.com>
Cc: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/asm-x86_64/timex.h')
-rw-r--r-- | include/asm-x86_64/timex.h | 26 |
1 files changed, 1 insertions, 25 deletions
diff --git a/include/asm-x86_64/timex.h b/include/asm-x86_64/timex.h index b9e5320b7625..a4493a77d641 100644 --- a/include/asm-x86_64/timex.h +++ b/include/asm-x86_64/timex.h | |||
@@ -12,35 +12,11 @@ | |||
12 | #include <asm/hpet.h> | 12 | #include <asm/hpet.h> |
13 | #include <asm/system.h> | 13 | #include <asm/system.h> |
14 | #include <asm/processor.h> | 14 | #include <asm/processor.h> |
15 | #include <asm/tsc.h> | ||
15 | #include <linux/compiler.h> | 16 | #include <linux/compiler.h> |
16 | 17 | ||
17 | #define CLOCK_TICK_RATE PIT_TICK_RATE /* Underlying HZ */ | 18 | #define CLOCK_TICK_RATE PIT_TICK_RATE /* Underlying HZ */ |
18 | 19 | ||
19 | typedef unsigned long long cycles_t; | ||
20 | |||
21 | static inline cycles_t get_cycles (void) | ||
22 | { | ||
23 | unsigned long long ret; | ||
24 | |||
25 | rdtscll(ret); | ||
26 | return ret; | ||
27 | } | ||
28 | |||
29 | /* Like get_cycles, but make sure the CPU is synchronized. */ | ||
30 | static __always_inline cycles_t get_cycles_sync(void) | ||
31 | { | ||
32 | unsigned long long ret; | ||
33 | unsigned eax; | ||
34 | /* Don't do an additional sync on CPUs where we know | ||
35 | RDTSC is already synchronous. */ | ||
36 | alternative_io("cpuid", ASM_NOP2, X86_FEATURE_SYNC_RDTSC, | ||
37 | "=a" (eax), "0" (1) : "ebx","ecx","edx","memory"); | ||
38 | rdtscll(ret); | ||
39 | return ret; | ||
40 | } | ||
41 | |||
42 | extern unsigned int cpu_khz; | ||
43 | |||
44 | extern int read_current_timer(unsigned long *timer_value); | 20 | extern int read_current_timer(unsigned long *timer_value); |
45 | #define ARCH_HAS_READ_CURRENT_TIMER 1 | 21 | #define ARCH_HAS_READ_CURRENT_TIMER 1 |
46 | 22 | ||