]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
x86: clean up rdtsc_barrier() use
authorIngo Molnar <mingo@elte.hu>
Sat, 8 Nov 2008 19:27:00 +0000 (20:27 +0100)
committerIngo Molnar <mingo@elte.hu>
Sat, 8 Nov 2008 19:27:00 +0000 (20:27 +0100)
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>
arch/x86/include/asm/tsc.h
arch/x86/kernel/vsyscall_64.c

index 9cd83a8e40d59a3dae2978e23887d81311370ae3..700aeb8d2098f2748ae6a3c3a9edf2829a00522c 100644 (file)
@@ -44,11 +44,7 @@ static __always_inline cycles_t vget_cycles(void)
        if (!cpu_has_tsc)
                return 0;
 #endif
-       rdtsc_barrier();
-       cycles = (cycles_t)__native_read_tsc();
-       rdtsc_barrier();
-
-       return cycles;
+       return (cycles_t)__native_read_tsc();
 }
 
 extern void tsc_init(void);
index 0b8b6690a86d184959703177b9cb6011bfd605ca..ebf2f12900f5d999aa8f6a57322e34743dae2bfb 100644 (file)
@@ -128,7 +128,16 @@ static __always_inline void do_vgettimeofday(struct timeval * tv)
                        gettimeofday(tv,NULL);
                        return;
                }
+
+               /*
+                * Surround the RDTSC by barriers, to make sure it's not
+                * speculated to outside the seqlock critical section and
+                * does not cause time warps:
+                */
+               rdtsc_barrier();
                now = vread();
+               rdtsc_barrier();
+
                base = __vsyscall_gtod_data.clock.cycle_last;
                mask = __vsyscall_gtod_data.clock.mask;
                mult = __vsyscall_gtod_data.clock.mult;