x86/asm/tsc/sync: Use rdtsc_ordered() in check_tsc_warp() and drop extra barriers
authorAndy Lutomirski <[email protected]>
Thu, 25 Jun 2015 16:44:09 +0000 (18:44 +0200)
committerIngo Molnar <[email protected]>
Mon, 6 Jul 2015 13:23:29 +0000 (15:23 +0200)
commiteee6946e44510b61c35cf754f5505537c7a8eb77
tree7ab8f64af8823d64b59d9b4f5fea9e26056d902c
parent03b9730b769fc4d87e40f6104f4c5b2e43889f19
x86/asm/tsc/sync: Use rdtsc_ordered() in check_tsc_warp() and drop extra barriers

Using get_cycles was unnecessary: check_tsc_warp() is not called
on TSC-less systems. Replace rdtsc_barrier(); get_cycles() with
rdtsc_ordered().

While we're at it, make the somewhat more dangerous change of
removing barrier_before_rdtsc after RDTSC in the TSC warp check
code. This should be okay, though -- the vDSO TSC code doesn't
have that barrier, so, if removing the barrier from the warp
check would cause us to detect a warp that we otherwise wouldn't
detect, then we have a genuine bug.

Signed-off-by: Andy Lutomirski <[email protected]>
Signed-off-by: Borislav Petkov <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Brian Gerst <[email protected]>
Cc: Denys Vlasenko <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Huang Rui <[email protected]>
Cc: John Stultz <[email protected]>
Cc: Len Brown <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Ralf Baechle <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: kvm ML <[email protected]>
Link: http://lkml.kernel.org/r/387c4c3a75f875bcde6cd68cee013273a744f364.1434501121.git.luto@kernel.org
Signed-off-by: Ingo Molnar <[email protected]>
arch/x86/kernel/tsc_sync.c