From 4cd1de2f48e8c825073be4f658de7827d8c3cb26 Mon Sep 17 00:00:00 2001 From: Andi Kleen Date: Wed, 2 May 2007 19:27:21 +0200 Subject: [PATCH] --- yaml --- r: 53935 b: refs/heads/master c: c5bcb5635a03da3158f121ae20ccbbf72b4fc62a h: refs/heads/master i: 53933: 032357b6b4f4f7b853c4661512803e1808c56647 53931: 0fd0401fb0df4e05db2451870592eef2b147fb6d 53927: 8c9a1e0d951d40c9fa510f708bfbda5555dca207 53919: b6b981bccb5f944e93a5c11a04f6dcf210cb74fc v: v3 --- [refs] | 2 +- trunk/include/asm-i386/tsc.h | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index ddb15f6a0d78..13c98a418be9 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 9bccb23dc5fc2d268ab676e2d4212d29e230fd86 +refs/heads/master: c5bcb5635a03da3158f121ae20ccbbf72b4fc62a diff --git a/trunk/include/asm-i386/tsc.h b/trunk/include/asm-i386/tsc.h index 0181f9df7539..3f3c1fa000b4 100644 --- a/trunk/include/asm-i386/tsc.h +++ b/trunk/include/asm-i386/tsc.h @@ -37,6 +37,15 @@ static __always_inline cycles_t get_cycles_sync(void) unsigned long long ret; unsigned eax; + /* + * Use RDTSCP if possible; it is guaranteed to be synchronous + * and doesn't cause a VMEXIT on Hypervisors + */ + alternative_io(ASM_NOP3, ".byte 0x0f,0x01,0xf9", X86_FEATURE_RDTSCP, + "=A" (ret), "0" (0ULL) : "ecx", "memory"); + if (ret) + return ret; + /* * Don't do an additional sync on CPUs where we know * RDTSC is already synchronous: