diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-11-08 14:27:00 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-11-08 14:27:00 -0500 |
commit | cb9e35dce94a1b9c59d46224e8a94377d673e204 (patch) | |
tree | e3772e7d6ed11d1c1c648799e78619f782e5e090 /arch/x86 | |
parent | 895e031707954a9ca26ed4f5f794575313854ed1 (diff) |
x86: clean up rdtsc_barrier() use
Impact: cleanup
Move rdtsc_barrier() use to vsyscall_64.c where it's relied on,
and point out its role in the context of its use.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/include/asm/tsc.h | 6 | ||||
-rw-r--r-- | arch/x86/kernel/vsyscall_64.c | 9 |
2 files changed, 10 insertions, 5 deletions
diff --git a/arch/x86/include/asm/tsc.h b/arch/x86/include/asm/tsc.h index 9cd83a8e40d5..700aeb8d2098 100644 --- a/arch/x86/include/asm/tsc.h +++ b/arch/x86/include/asm/tsc.h | |||
@@ -44,11 +44,7 @@ static __always_inline cycles_t vget_cycles(void) | |||
44 | if (!cpu_has_tsc) | 44 | if (!cpu_has_tsc) |
45 | return 0; | 45 | return 0; |
46 | #endif | 46 | #endif |
47 | rdtsc_barrier(); | 47 | return (cycles_t)__native_read_tsc(); |
48 | cycles = (cycles_t)__native_read_tsc(); | ||
49 | rdtsc_barrier(); | ||
50 | |||
51 | return cycles; | ||
52 | } | 48 | } |
53 | 49 | ||
54 | extern void tsc_init(void); | 50 | extern void tsc_init(void); |
diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c index 0b8b6690a86d..ebf2f12900f5 100644 --- a/arch/x86/kernel/vsyscall_64.c +++ b/arch/x86/kernel/vsyscall_64.c | |||
@@ -128,7 +128,16 @@ static __always_inline void do_vgettimeofday(struct timeval * tv) | |||
128 | gettimeofday(tv,NULL); | 128 | gettimeofday(tv,NULL); |
129 | return; | 129 | return; |
130 | } | 130 | } |
131 | |||
132 | /* | ||
133 | * Surround the RDTSC by barriers, to make sure it's not | ||
134 | * speculated to outside the seqlock critical section and | ||
135 | * does not cause time warps: | ||
136 | */ | ||
137 | rdtsc_barrier(); | ||
131 | now = vread(); | 138 | now = vread(); |
139 | rdtsc_barrier(); | ||
140 | |||
132 | base = __vsyscall_gtod_data.clock.cycle_last; | 141 | base = __vsyscall_gtod_data.clock.cycle_last; |
133 | mask = __vsyscall_gtod_data.clock.mask; | 142 | mask = __vsyscall_gtod_data.clock.mask; |
134 | mult = __vsyscall_gtod_data.clock.mult; | 143 | mult = __vsyscall_gtod_data.clock.mult; |