Commit cb9e35dc authored by Ingo Molnar's avatar Ingo Molnar

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: default avatarIngo Molnar <mingo@elte.hu>
parent 895e0317
...@@ -44,11 +44,7 @@ static __always_inline cycles_t vget_cycles(void) ...@@ -44,11 +44,7 @@ static __always_inline cycles_t vget_cycles(void)
if (!cpu_has_tsc) if (!cpu_has_tsc)
return 0; return 0;
#endif #endif
rdtsc_barrier(); return (cycles_t)__native_read_tsc();
cycles = (cycles_t)__native_read_tsc();
rdtsc_barrier();
return cycles;
} }
extern void tsc_init(void); extern void tsc_init(void);
......
...@@ -128,7 +128,16 @@ static __always_inline void do_vgettimeofday(struct timeval * tv) ...@@ -128,7 +128,16 @@ static __always_inline void do_vgettimeofday(struct timeval * tv)
gettimeofday(tv,NULL); gettimeofday(tv,NULL);
return; 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(); now = vread();
rdtsc_barrier();
base = __vsyscall_gtod_data.clock.cycle_last; base = __vsyscall_gtod_data.clock.cycle_last;
mask = __vsyscall_gtod_data.clock.mask; mask = __vsyscall_gtod_data.clock.mask;
mult = __vsyscall_gtod_data.clock.mult; mult = __vsyscall_gtod_data.clock.mult;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment