Re: [PATCH: x86] Print the hypervisor returned tsc_khz during boot.

From: Alok Kataria
Date: Fri Sep 04 2009 - 16:13:46 EST


> Makes sense. Note, arch/x86/kernel/tsc.c changed recently so this
> patch does not apply anymore - mind merging it on top of that and
> re-send it?

Sure, here is the one which fits on top of current tip.

I also added a print statement for the case where the TSC frequecy
cannot be read from vmware's hypervisor.


On an AMD-64 system the processor frequency that is printed during
system boot, may be different than the tsc frequency that was returned
by the hypervisor, due to the value returned from calibrate_cpu. For
debugging timekeeping or other related issues it might be better to get
the tsc_khz value returned by the hypervisor.

The patch below now prints the tsc frequency that the VMware hypervisor
returned. Please consider for tip.

Signed-off-by: Alok N Kataria <akataria@xxxxxxxxxx>

Index: linux-x86-tree.git/arch/x86/kernel/cpu/vmware.c
--- linux-x86-tree.git.orig/arch/x86/kernel/cpu/vmware.c 2009-09-04 12:59:45.000000000 -0700
+++ linux-x86-tree.git/arch/x86/kernel/cpu/vmware.c 2009-09-04 13:01:41.000000000 -0700
@@ -58,6 +58,9 @@ static unsigned long vmware_get_tsc_khz(
tsc_hz = eax | (((uint64_t)ebx) << 32);
do_div(tsc_hz, 1000);
BUG_ON(tsc_hz >> 32);
+ printk(KERN_INFO "TSC freq read from hypervisor : %lu.%03lu MHz\n",
+ (unsigned long) tsc_hz / 1000,
+ (unsigned long) tsc_hz % 1000);
return tsc_hz;

@@ -69,6 +72,9 @@ void __init vmware_platform_setup(void)

if (ebx != UINT_MAX)
x86_platform.calibrate_tsc = vmware_get_tsc_khz;
+ else
+ "Failed to get TSC freq from the hypervisor\n");


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at