x86/asm/tsc, kvm: Remove vget_cycles()
authorAndy Lutomirski <[email protected]>
Thu, 25 Jun 2015 16:43:56 +0000 (18:43 +0200)
committerIngo Molnar <[email protected]>
Mon, 6 Jul 2015 13:23:25 +0000 (15:23 +0200)
The only caller was KVM's read_tsc(). The only difference
between vget_cycles() and native_read_tsc() was that
vget_cycles() returned zero instead of crashing on TSC-less
systems. KVM already checks vclock_mode() before calling that
function, so the extra check is unnecessary. Also, KVM
(host-side) requires the TSC to exist.

Signed-off-by: Andy Lutomirski <[email protected]>
Signed-off-by: Borislav Petkov <[email protected]>
Acked-by: Paolo Bonzini <[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/20615df14ae2eb713ea7a5f5123c1dc4c7ca993d.1434501121.git.luto@kernel.org
Signed-off-by: Ingo Molnar <[email protected]>
arch/x86/include/asm/tsc.h
arch/x86/kvm/x86.c

index fd11128faf25363e7cdbb6f14fb643d5b7024972..3da1cc1218ac9865a4544a6ca6e44a8d61234554 100644 (file)
@@ -32,19 +32,6 @@ static inline cycles_t get_cycles(void)
        return ret;
 }
 
-static __always_inline cycles_t vget_cycles(void)
-{
-       /*
-        * We only do VDSOs on TSC capable CPUs, so this shouldn't
-        * access boot_cpu_data (which is not VDSO-safe):
-        */
-#ifndef CONFIG_X86_TSC
-       if (!cpu_has_tsc)
-               return 0;
-#endif
-       return (cycles_t)native_read_tsc();
-}
-
 extern void tsc_init(void);
 extern void mark_tsc_unstable(char *reason);
 extern int unsynchronized_tsc(void);
index bbaf44e8f0d3cdd7100c40c98ccf2ab40ae1ea2f..f771058cfb5cc4376e89b8870423803fa572b599 100644 (file)
@@ -1455,7 +1455,7 @@ static cycle_t read_tsc(void)
         * but no one has ever seen it happen.
         */
        rdtsc_barrier();
-       ret = (cycle_t)vget_cycles();
+       ret = (cycle_t)native_read_tsc();
 
        last = pvclock_gtod_data.clock.cycle_last;