All of lore.kernel.org
 help / color / mirror / Atom feed
* [Patch] Skip cpu_calibrate for kernel running under hypervisors.
@ 2010-08-16 19:25 Alok Kataria
  2010-08-16 23:56 ` H. Peter Anvin
  0 siblings, 1 reply; 28+ messages in thread
From: Alok Kataria @ 2010-08-16 19:25 UTC (permalink / raw)
  To: H. Peter Anvin, the arch/x86 maintainers; +Cc: Greg KH, greg, ksrinivasan, LKML

Hi, 

This is a trivial change to fix the cpu_khz value returned when running
on a virtualized environment. We have seen instances when the cpu_khz
value is off by couple of MHz's when running on VMware's platform on AMD
hardware.

--
Since the TSC frequency read from hypervisor is accurate for the guest, and
since the hypervisor will always clock the vcpu at the TSC frequency, there is
no need to calibrate it again. To avoid any calibration errors through
calibrate_cpu this patch skips calling calibrate_cpu for kernel running
under hypervisors.

Signed-off-by: Alok N Kataria <akataria@vmware.com>
Cc: K. Y. Srinivasan <ksrinivasan@novell.com>
Cc: Greg KH <greg@kroah.com>
Cc: H. Peter Anvin <hpa@zytor.com>

Index: linux-x86-tree.git/arch/x86/kernel/tsc.c
===================================================================
--- linux-x86-tree.git.orig/arch/x86/kernel/tsc.c	2010-08-03 12:21:20.000000000 -0700
+++ linux-x86-tree.git/arch/x86/kernel/tsc.c	2010-08-13 15:07:08.000000000 -0700
@@ -927,7 +927,7 @@ void __init tsc_init(void)
 	}
 
 	if (cpu_has(&boot_cpu_data, X86_FEATURE_CONSTANT_TSC) &&
-			(boot_cpu_data.x86_vendor == X86_VENDOR_AMD))
+	    (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) && !x86_hyper)
 		cpu_khz = calibrate_cpu();
 
 	printk("Detected %lu.%03lu MHz processor.\n",



^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2010-08-26  7:19 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-16 19:25 [Patch] Skip cpu_calibrate for kernel running under hypervisors Alok Kataria
2010-08-16 23:56 ` H. Peter Anvin
2010-08-17  5:51   ` Alok Kataria
2010-08-17  6:30     ` H. Peter Anvin
2010-08-17  7:05       ` Borislav Petkov
2010-08-17 16:45         ` Alok Kataria
2010-08-17 18:56           ` Borislav Petkov
2010-08-18 16:16             ` [PATCH] x86, tsc: Limit CPU frequency calibration on AMD Borislav Petkov
2010-08-18 16:23               ` H. Peter Anvin
2010-08-18 17:34                 ` Borislav Petkov
2010-08-18 17:44                   ` H. Peter Anvin
2010-08-18 17:51                   ` Alok Kataria
2010-08-18 18:45                     ` Borislav Petkov
2010-08-24 15:53                       ` [PATCH -v2] " Borislav Petkov
2010-08-24 17:51                         ` Alok Kataria
2010-08-24 22:33                         ` H. Peter Anvin
2010-08-25  7:06                           ` Borislav Petkov
2010-08-25 13:04                             ` Andreas Herrmann
2010-08-25 13:39                               ` Andreas Herrmann
2010-08-25 16:28                               ` [PATCH -v3] x86, tsc: Remove " Borislav Petkov
2010-08-25 21:36                                 ` [tip:x86/cpu] " tip-bot for Borislav Petkov
2010-08-25 22:33                                 ` [PATCH -v3] " Alok Kataria
2010-08-26  7:19                                   ` Borislav Petkov
2010-08-19 18:47               ` [PATCH] x86, tsc: Limit " john stultz
2010-08-19 20:29                 ` Borislav Petkov
2010-08-19 20:52                   ` john stultz
2010-08-17 16:48       ` [Patch] Skip cpu_calibrate for kernel running under hypervisors Alok Kataria
2010-08-17 16:49         ` H. Peter Anvin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.