Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1164447

[PATCH 02/17] x86/msr/kvm: Remove vget_cycles()

From Andy Lutomirski <luto@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 02/17] x86/msr/kvm: Remove vget_cycles()
Date 2015-06-13 01:50 +0200
Message-ID <pAGRY-44S-23@gated-at.bofh.it> (permalink)
References <pAGRX-44S-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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's already checks
vclock_mode before calling that function, so the extra check is
unnecessary.

(Off-topic, but the whole KVM clock host implementation is gross.
 IMO it should be rewritten.)

Signed-off-by: Andy Lutomirski <luto@kernel.org>
---
 arch/x86/include/asm/tsc.h | 13 -------------
 arch/x86/kvm/x86.c         |  2 +-
 2 files changed, 1 insertion(+), 14 deletions(-)

diff --git a/arch/x86/include/asm/tsc.h b/arch/x86/include/asm/tsc.h
index fd11128faf25..3da1cc1218ac 100644
--- a/arch/x86/include/asm/tsc.h
+++ b/arch/x86/include/asm/tsc.h
@@ -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);
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 26eaeb522cab..c26faf408bce 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1430,7 +1430,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;
 
-- 
2.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/17] x86/tsc: Clean up rdtsc helpers Andy Lutomirski <luto@kernel.org> - 2015-06-13 01:50 +0200
  [PATCH 13/17] x86/tsc: Rename native_read_tsc() to rdtsc_unordered() Andy Lutomirski <luto@kernel.org> - 2015-06-13 01:50 +0200
  [PATCH 16/17] x86/tsc: Use rdtsc_ordered() in check_tsc_warp() and drop extra barriers Andy Lutomirski <luto@kernel.org> - 2015-06-13 01:50 +0200
  [PATCH 04/17] x86/tsc: Remove the rdtscp and rdtscpll macros Andy Lutomirski <luto@kernel.org> - 2015-06-13 01:50 +0200
  [PATCH 02/17] x86/msr/kvm: Remove vget_cycles() Andy Lutomirski <luto@kernel.org> - 2015-06-13 01:50 +0200
  [PATCH 14/17] x86/tsc: Move rdtsc_barrier() and rename it to barrier_before_rdtsc() Andy Lutomirski <luto@kernel.org> - 2015-06-13 01:50 +0200
  [PATCH 15/17] x86: Add rdtsc_ordered() and use it in trivial call sites Andy Lutomirski <luto@kernel.org> - 2015-06-13 01:50 +0200
  [PATCH 10/17] input/joystick/analog: Switch from rdtscl() to native_read_tsc() Andy Lutomirski <luto@kernel.org> - 2015-06-13 01:50 +0200
  [PATCH 07/17] x86/cpu/amd: Use the full 64-bit TSC to detect the 2.6.2 bug Andy Lutomirski <luto@kernel.org> - 2015-06-13 01:50 +0200
  [PATCH 11/17] drivers/input/gameport: Replace rdtscl() with native_read_tsc() Andy Lutomirski <luto@kernel.org> - 2015-06-13 01:50 +0200
  [PATCH 17/17] x86/tsc: In read_tsc, use rdtsc_ordered() instead of get_cycles() Andy Lutomirski <luto@kernel.org> - 2015-06-13 01:50 +0200
  [PATCH 09/17] staging/lirc_serial: Remove TSC-based timing Andy Lutomirski <luto@kernel.org> - 2015-06-13 01:50 +0200
  [PATCH 16/17] x86/tsc: Use rdtsc_unordered() in check_tsc_warp() Andy Lutomirski <luto@kernel.org> - 2015-06-13 01:50 +0200
  [PATCH 12/17] x86/tsc: Remove rdtscl() Andy Lutomirski <luto@kernel.org> - 2015-06-13 01:50 +0200
  [PATCH 03/17] x86/tsc: Replace rdtscll with native_read_tsc Andy Lutomirski <luto@kernel.org> - 2015-06-13 02:00 +0200
  [PATCH 01/17] x86/tsc: Inline native_read_tsc and remove __native_read_tsc Andy Lutomirski <luto@kernel.org> - 2015-06-13 02:00 +0200
  [PATCH 08/17] baycom_epp: Replace rdtscl() with native_read_tsc() Andy Lutomirski <luto@kernel.org> - 2015-06-13 02:00 +0200
  [PATCH 03/17] x86/tsc/paravirt: Remove the read_tsc and read_tscp paravirt hooks Andy Lutomirski <luto@kernel.org> - 2015-06-13 02:00 +0200
  [PATCH 05/17] x86/tsc: Remove the rdtscp and rdtscpll macros Andy Lutomirski <luto@kernel.org> - 2015-06-13 02:00 +0200
  [PATCH 06/17] x86/tsc: Use the full 64-bit tsc in tsc_delay Andy Lutomirski <luto@kernel.org> - 2015-06-13 02:00 +0200
  [PATCH 04/17] x86/tsc: Replace rdtscll with native_read_tsc Andy Lutomirski <luto@kernel.org> - 2015-06-13 02:00 +0200
  [PATCH 05/17] x86/tsc/paravirt: Remove the read_tsc and read_tscp paravirt hooks Andy Lutomirski <luto@kernel.org> - 2015-06-13 02:00 +0200

csiph-web