While working on TSC-handling code, I missed an important
piece of code that writes to TSC because it does it
differently than other pieces of code. Fix that,
and also cleanup a bit to avoid hardcoded constants
and use wrmsrl instead of wrmsr plus handwritten 64-bit
dismembering code.
Signed-off-by: Dan Magenheimer <dan.magenheimer@xxxxxxxxxx>
diff -r 72d130772f36 xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c Wed Sep 16 09:30:41 2009 +0100
+++ b/xen/arch/x86/smpboot.c Mon Sep 21 11:03:24 2009 -0600
@@ -223,7 +223,7 @@ static void __init synchronize_tsc_bp (v
* We clear the TSC in the last loop:
*/
if (i == NR_LOOPS-1)
- write_tsc(0, 0);
+ write_tsc(0L);
/*
* Wait for all APs to leave the synchronization point:
@@ -293,7 +293,7 @@ static void __init synchronize_tsc_ap (v
rdtscll(tsc_values[smp_processor_id()]);
if (i == NR_LOOPS-1)
- write_tsc(0, 0);
+ write_tsc(0L);
atomic_inc(&tsc_count_stop);
while (atomic_read(&tsc_count_stop) != num_booting_cpus()) mb();
diff -r 72d130772f36 xen/arch/x86/time.c
--- a/xen/arch/x86/time.c Wed Sep 16 09:30:41 2009 +0100
+++ b/xen/arch/x86/time.c Mon Sep 21 11:03:24 2009 -0600
@@ -699,7 +699,7 @@ void cstate_restore_tsc(void)
struct cpu_time *t = &this_cpu(cpu_time);
struct time_scale sys_to_tsc = scale_reciprocal(t->tsc_scale);
s_time_t stime_delta;
- u64 tsc_delta;
+ u64 new_tsc;
if ( boot_cpu_has(X86_FEATURE_NOSTOP_TSC) )
return;
@@ -708,9 +708,9 @@ void cstate_restore_tsc(void)
if ( stime_delta < 0 )
stime_delta = 0;
- tsc_delta = scale_delta(stime_delta, &sys_to_tsc);
+ new_tsc = t->local_tsc_stamp + scale_delta(stime_delta, &sys_to_tsc);
- wrmsrl(MSR_IA32_TSC, t->local_tsc_stamp + tsc_delta);
+ write_tsc(new_tsc);
}
/***************************************************************************
@@ -1126,8 +1126,7 @@ static void time_calibration_tsc_rendezv
atomic_inc(&r->semaphore);
if ( i == 0 )
- write_tsc((u32)r->master_tsc_stamp,
- (u32)(r->master_tsc_stamp >> 32));
+ write_tsc(r->master_tsc_stamp);
while ( atomic_read(&r->semaphore) != (2*total_cpus - 1) )
mb();
@@ -1140,8 +1139,7 @@ static void time_calibration_tsc_rendezv
mb();
if ( i == 0 )
- write_tsc((u32)r->master_tsc_stamp,
- (u32)(r->master_tsc_stamp >> 32));
+ write_tsc(r->master_tsc_stamp);
atomic_inc(&r->semaphore);
while ( atomic_read(&r->semaphore) > total_cpus )
diff -r 72d130772f36 xen/include/asm-x86/msr.h
--- a/xen/include/asm-x86/msr.h Wed Sep 16 09:30:41 2009 +0100
+++ b/xen/include/asm-x86/msr.h Mon Sep 21 11:03:24 2009 -0600
@@ -82,7 +82,7 @@ static inline void wrmsrl(unsigned int m
} while(0)
#endif
-#define write_tsc(val1,val2) wrmsr(0x10, val1, val2)
+#define write_tsc(val) wrmsrl(MSR_IA32_TSC, val)
#define rdpmc(counter,low,high) \
__asm__ __volatile__("rdpmc" \
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|