Print the hypervisor returned tsc_khz during boot.
Subsystems (2)
PATCH 1/1 Print the hypervisor returned tsc_khz during boot.
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 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 hypervisor returned. Please consider for tip.
--
arch/x86/kernel/tsc.c +4 -1
@@ -405,7 +405,10 @@ unsigned long native_calibrate_tsc(void) hv_tsc_khz =get_hypervisor_tsc_freq ();if (hv_tsc_khz) { -printk (KERN_INFO "TSC: Frequency read from the hypervisor\n" ); +printk (KERN_INFO "TSC: Frequency read from the hypervisor : " +"%lu.%03lu MHz\n" , + (unsigned long ) hv_tsc_khz /1000 , + (unsigned long ) hv_tsc_khz %1000 );return hv_tsc_khz; }
Quoted 18 lines · Alok Kataria
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 value returned from
calibrate_cpu. For debugging timekeeping or other related issues it might be better to get thetsc_khzvalue returned by the hypervisor.The patch below now prints the tsc frequency that the hypervisor returned. Please consider for tip.
--
Signed-off-by Alok N Kataria <[email protected]>Index:
linux-tip-master/arch/x86/kernel/tsc.c
===================================================================
arch/x86/kernel/tsc.c unsigned long native_calibrate_tsc(void) · line 413
Quoted 10 lines
arch/x86/kernel/tsc.c +4
-1@@ -405,7 +405,10 @@ unsigned long native_calibrate_tsc(void) hv_tsc_khz =get_hypervisor_tsc_freq ();if (hv_tsc_khz) { -printk (KERN_INFO "TSC: Frequency read from the hypervisor\n" ); +printk (KERN_INFO "TSC: Frequency read from the hypervisor : " +"%lu.%03lu MHz\n" , + (unsigned long ) hv_tsc_khz /1000 , + (unsigned long ) hv_tsc_khz %1000 );return hv_tsc_khz; }
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?
Thanks,
Ingo
<snip>...
Quoted 3 lines
Makes sense. Note,
arch/x86/kernel/tsc.cchanged 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.
Thanks.
--
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.
---
arch/x86/kernel/cpu/vmware.c +6 -0
@@ -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 +printk (KERN_WARNING +"Failed to get TSC freq from the hypervisor\n" ); }/*
[tip:x86/urgent] x86: Print the hypervisor returned tsc_khz during boot
Commit-ID: 6399c087458859cddff2d6b46befb95b866df3e0 Gitweb: http://git.kernel.org/tip/6399c087458859cddff2d6b46befb95b866df3e0 Author: Alok Kataria <[email protected]> AuthorDate: Fri, 4 Sep 2009 13:13:39 -0700 Committer: Ingo Molnar <[email protected]> CommitDate: Sun, 20 Sep 2009 20:25:36 +0200
x86: Print the hypervisor returned tsc_khz during boot
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.
LKML-Reference: <[email protected]>
--- arch/x86/kernel/cpu/vmware.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
arch/x86/kernel/cpu/vmware.c +6 -0
@@ -58,6 +58,9 @@ static unsigned long vmware_get_tsc_khz(void) 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 +printk (KERN_WARNING +"Failed to get TSC freq from the hypervisor\n" ); }/*