diff options
author | Keir Fraser <keir@xen.org> | 2011-05-16 13:37:28 +0100 |
---|---|---|
committer | Keir Fraser <keir@xen.org> | 2011-05-16 13:37:28 +0100 |
commit | b9b9d411d763218683e3480b4c8ea9bd008838bd (patch) | |
tree | 67d535424afc2e22fefe691f709714c1980ccb28 | |
parent | b6014582d1ab649600d62d3ef4757f928f4e5776 (diff) | |
download | xen-b9b9d411d763218683e3480b4c8ea9bd008838bd.tar.gz xen-b9b9d411d763218683e3480b4c8ea9bd008838bd.tar.bz2 xen-b9b9d411d763218683e3480b4c8ea9bd008838bd.zip |
x86/tsc: Remove incorrect assertion from cstate_restore_tsc()...
..fix and move to write_tsc().
Signed-off-by: Keir Fraser <keir@xen.org>
xen-unstable changeset: 23342:16d12acccacf
xen-unstable date: Mon May 16 13:24:05 2011 +0100
-rw-r--r-- | xen/arch/x86/smpboot.c | 7 | ||||
-rw-r--r-- | xen/arch/x86/time.c | 2 | ||||
-rw-r--r-- | xen/include/asm-x86/msr.h | 8 |
3 files changed, 13 insertions, 4 deletions
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index 61cdc17259..68e4eb53a4 100644 --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@ -185,7 +185,12 @@ static void synchronize_tsc_slave(unsigned int slave) while ( atomic_read(&tsc_count) != ((i<<1)-1) ) cpu_relax(); rmb(); - write_tsc(tsc_value); + /* + * If a CPU has been physically hotplugged, we may as well write + * to its TSC in spite of X86_FEATURE_TSC_RELIABLE. The platform does + * not sync up a new CPU's TSC for us. + */ + __write_tsc(tsc_value); atomic_inc(&tsc_count); } } diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index d4a5c61767..25035bcd2f 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -683,8 +683,6 @@ void cstate_restore_tsc(void) if ( boot_cpu_has(X86_FEATURE_NONSTOP_TSC) ) return; - ASSERT(boot_cpu_has(X86_FEATURE_TSC_RELIABLE)); - write_tsc(stime2tsc(read_platform_stime())); } diff --git a/xen/include/asm-x86/msr.h b/xen/include/asm-x86/msr.h index 09fa288081..3b4132f867 100644 --- a/xen/include/asm-x86/msr.h +++ b/xen/include/asm-x86/msr.h @@ -87,7 +87,13 @@ static inline int wrmsr_safe(unsigned int msr, uint64_t val) } while(0) #endif -#define write_tsc(val) wrmsrl(MSR_IA32_TSC, val) +#define __write_tsc(val) wrmsrl(MSR_IA32_TSC, val) +#define write_tsc(val) ({ \ + /* Reliable TSCs are in lockstep across all CPUs. We should \ + * never write to them. */ \ + ASSERT(!boot_cpu_has(X86_FEATURE_TSC_RELIABLE)); \ + __write_tsc(val); \ +}) #define write_rdtscp_aux(val) wrmsr(MSR_TSC_AUX, (val), 0) |