[PATCH 6/6] x86: read_tsc sync

Alok Kataria akataria at vmware.com
Tue Jun 3 23:37:04 UTC 2008


OriginalAuthor: Ingo Molnar <mingo at elte.hu>
Commit:	f06e4ec1c15691b0cfd2397ae32214fa36c90d71

make native_read_tsc() always non-speculative.

Signed-off-by: Alok N Kataria <akataria at vmware.com>
---
 include/asm-x86/msr.h |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/include/asm-x86/msr.h b/include/asm-x86/msr.h
index 80b0270..34038c0 100644
--- a/include/asm-x86/msr.h
+++ b/include/asm-x86/msr.h
@@ -13,6 +13,7 @@
 #ifndef __ASSEMBLY__
 
 #include <asm/errno.h>
+#include <asm/system.h>
 
 static inline unsigned long long native_read_msr(unsigned int msr)
 {
@@ -69,7 +70,11 @@ static inline int native_write_msr_safe(unsigned int msr,
 static inline unsigned long long native_read_tsc(void)
 {
 	unsigned long long val;
+
+	rdtsc_barrier();
 	asm volatile("rdtsc" : "=A" (val));
+	rdtsc_barrier();
+
 	return val;
 }
 
-- 
1.5.4







More information about the kernel-team mailing list