aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-01-30 07:32:40 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:32:40 -0500
commit92767af0e3904b4d35ed547fb514ff6cb227e678 (patch)
tree635be2878ede16e4b12d23cfbd9d8dd16406dcef
parent6d63de8dbcda98511206897562ecfcdacf18f523 (diff)
x86: fix sched_clock()
[ andi@firstfloor.org: build fix ] Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--arch/x86/kernel/rtc.c13
-rw-r--r--include/asm-x86/msr.h11
-rw-r--r--include/asm-x86/tsc.h2
3 files changed, 16 insertions, 10 deletions
diff --git a/arch/x86/kernel/rtc.c b/arch/x86/kernel/rtc.c
index 276cb7073ab1..eb9b1a198f5e 100644
--- a/arch/x86/kernel/rtc.c
+++ b/arch/x86/kernel/rtc.c
@@ -196,14 +196,9 @@ int update_persistent_clock(struct timespec now)
196 return set_rtc_mmss(now.tv_sec); 196 return set_rtc_mmss(now.tv_sec);
197} 197}
198 198
199unsigned long long __vsyscall_fn native_read_tsc(void) 199unsigned long long native_read_tsc(void)
200{ 200{
201 DECLARE_ARGS(val, low, high); 201 return __native_read_tsc();
202
203 rdtsc_barrier();
204 asm volatile("rdtsc" : EAX_EDX_RET(val, low, high));
205 rdtsc_barrier();
206
207 return EAX_EDX_VAL(val, low, high);
208} 202}
209EXPORT_SYMBOL_GPL(native_read_tsc); 203EXPORT_SYMBOL(native_read_tsc);
204
diff --git a/include/asm-x86/msr.h b/include/asm-x86/msr.h
index decfec4ab17c..204a8a30fecf 100644
--- a/include/asm-x86/msr.h
+++ b/include/asm-x86/msr.h
@@ -93,6 +93,17 @@ static inline int native_write_msr_safe(unsigned int msr,
93 93
94extern unsigned long long native_read_tsc(void); 94extern unsigned long long native_read_tsc(void);
95 95
96static __always_inline unsigned long long __native_read_tsc(void)
97{
98 DECLARE_ARGS(val, low, high);
99
100 rdtsc_barrier();
101 asm volatile("rdtsc" : EAX_EDX_RET(val, low, high));
102 rdtsc_barrier();
103
104 return EAX_EDX_VAL(val, low, high);
105}
106
96static inline unsigned long long native_read_pmc(int counter) 107static inline unsigned long long native_read_pmc(int counter)
97{ 108{
98 DECLARE_ARGS(val, low, high); 109 DECLARE_ARGS(val, low, high);
diff --git a/include/asm-x86/tsc.h b/include/asm-x86/tsc.h
index f51a50da35aa..071e0ce5b664 100644
--- a/include/asm-x86/tsc.h
+++ b/include/asm-x86/tsc.h
@@ -46,7 +46,7 @@ static inline cycles_t vget_cycles(void)
46 if (!cpu_has_tsc) 46 if (!cpu_has_tsc)
47 return 0; 47 return 0;
48#endif 48#endif
49 return (cycles_t) native_read_tsc(); 49 return (cycles_t) __native_read_tsc();
50} 50}
51 51
52extern void tsc_init(void); 52extern void tsc_init(void);