Messages in this thread Patch in this message | | | Subject | [PATCH] Skip tsc synchronization checks if CONSTANT_TSC bit is set. | From | Alok Kataria <> | Date | Wed, 22 Oct 2008 12:23:47 -0700 |
| |
Skip tsc synchronization checks if CONSTANT_TSC bit is set.
From: Alok N Kataria <akataria@vmware.com>
TSC synchronization checks between CPU's bail out even if we see a distortion of a single cycle. This makes the TSC mostly unsuable in a virtualized environment.
The CONSTANT_TSC bit tells us if the hardware exports a constant TSC, we can use this bit to trust the hardware and skip the TSC sync checks at bootup.
We also force set the CONSTANT_TSC capability bit if we are running on VMware, since the VMware hypervisor exports a constant TSC to the guest.
Signed-off-by: Alok N Kataria <akataria@vmware.com> Cc: Andi Kleen <andi@firstfloor.org> ---
arch/x86/kernel/cpu/common.c | 1 + arch/x86/kernel/tsc_sync.c | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index a48cb0e..720b583 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -452,6 +452,7 @@ void __cpuinit detect_hypervisor_vendor(struct cpuinfo_x86 *c) { if (vmware_platform()) { c->x86_hyper_vendor = X86_HYPER_VENDOR_VMWARE; + set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC); } else { c->x86_hyper_vendor = X86_HYPER_VENDOR_NONE; } diff --git a/arch/x86/kernel/tsc_sync.c b/arch/x86/kernel/tsc_sync.c index 9ffb01c..c0c89b7 100644 --- a/arch/x86/kernel/tsc_sync.c +++ b/arch/x86/kernel/tsc_sync.c @@ -108,6 +108,12 @@ void __cpuinit check_tsc_sync_source(int cpu) if (unsynchronized_tsc()) return; + if (boot_cpu_has(X86_FEATURE_CONSTANT_TSC)) { + printk(KERN_INFO + "Skipping synchronization checks as TSC is constant.\n"); + return; + } + printk(KERN_INFO "checking TSC synchronization [CPU#%d -> CPU#%d]:", smp_processor_id(), cpu); @@ -161,7 +167,7 @@ void __cpuinit check_tsc_sync_target(void) { int cpus = 2; - if (unsynchronized_tsc()) + if (unsynchronized_tsc() || boot_cpu_has(X86_FEATURE_CONSTANT_TSC)) return; /*
| |