diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2010-05-28 08:03:02 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2010-05-28 08:03:02 +0100 |
commit | 0f3f42694cc887cda3510891a13950c6cd0d9f2c (patch) | |
tree | 7af98773d0ffd98b66b9347d0a0eae05c540414b /xen/arch/x86/time.c | |
parent | 8b44f7eb129865e04ed4213fd9c89669812b601a (diff) | |
download | xen-0f3f42694cc887cda3510891a13950c6cd0d9f2c.tar.gz xen-0f3f42694cc887cda3510891a13950c6cd0d9f2c.tar.bz2 xen-0f3f42694cc887cda3510891a13950c6cd0d9f2c.zip |
x86: Warn on CPU hot-add to tsc-reliable system
...and provide a boot option to indicate TSCs may be skewed.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Diffstat (limited to 'xen/arch/x86/time.c')
-rw-r--r-- | xen/arch/x86/time.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index ee535c186e..d500490254 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -1598,6 +1598,25 @@ struct tm wallclock_time(void) * PV SoftTSC Emulation. */ +/* + * tsc=unstable: Override all tests; assume TSC is unreliable. + * tsc=skewed: Assume TSCs are individually reliable, but skewed across CPUs. + */ +static void __init tsc_parse(const char *s) +{ + if ( !strcmp(s, "unstable") ) + { + setup_clear_cpu_cap(X86_FEATURE_CONSTANT_TSC); + setup_clear_cpu_cap(X86_FEATURE_NONSTOP_TSC); + setup_clear_cpu_cap(X86_FEATURE_TSC_RELIABLE); + } + else if ( !strcmp(s, "skewed") ) + { + setup_clear_cpu_cap(X86_FEATURE_TSC_RELIABLE); + } +} +custom_param("tsc", tsc_parse); + u64 gtime_to_gtsc(struct domain *d, u64 tsc) { if ( !is_hvm_domain(d) ) @@ -1636,7 +1655,7 @@ void pv_soft_rdtsc(struct vcpu *v, struct cpu_user_regs *regs, int rdtscp) int host_tsc_is_safe(void) { - return boot_cpu_has(X86_FEATURE_TSC_RELIABLE) || (num_online_cpus() == 1); + return boot_cpu_has(X86_FEATURE_TSC_RELIABLE); } void cpuid_time_leaf(uint32_t sub_idx, uint32_t *eax, uint32_t *ebx, |