* [PATCH: x86] Print the hypervisor returned tsc_khz during boot.
@ 2009-08-24 1:08 Alok Kataria
2009-09-04 7:49 ` Ingo Molnar
0 siblings, 1 reply; 4+ messages in thread
From: Alok Kataria @ 2009-08-24 1:08 UTC (permalink / raw)
To: Ingo Molnar, the arch/x86 maintainers; +Cc: LKML
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.
--
Signed-off-by: Alok N Kataria <akataria@vmware.com>
Index: linux-tip-master/arch/x86/kernel/tsc.c
===================================================================
--- linux-tip-master.orig/arch/x86/kernel/tsc.c 2009-08-23 17:53:44.000000000 -0700
+++ linux-tip-master/arch/x86/kernel/tsc.c 2009-08-23 17:55:08.000000000 -0700
@@ -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;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH: x86] Print the hypervisor returned tsc_khz during boot.
2009-08-24 1:08 [PATCH: x86] Print the hypervisor returned tsc_khz during boot Alok Kataria
@ 2009-09-04 7:49 ` Ingo Molnar
2009-09-04 20:13 ` Alok Kataria
0 siblings, 1 reply; 4+ messages in thread
From: Ingo Molnar @ 2009-09-04 7:49 UTC (permalink / raw)
To: Alok Kataria, Thomas Gleixner; +Cc: the arch/x86 maintainers, LKML
* Alok Kataria <akataria@vmware.com> wrote:
> 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.
>
> --
> Signed-off-by: Alok N Kataria <akataria@vmware.com>
>
> Index: linux-tip-master/arch/x86/kernel/tsc.c
> ===================================================================
> --- linux-tip-master.orig/arch/x86/kernel/tsc.c 2009-08-23 17:53:44.000000000 -0700
> +++ linux-tip-master/arch/x86/kernel/tsc.c 2009-08-23 17:55:08.000000000 -0700
> @@ -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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH: x86] Print the hypervisor returned tsc_khz during boot.
2009-09-04 7:49 ` Ingo Molnar
@ 2009-09-04 20:13 ` Alok Kataria
2009-09-20 18:30 ` [tip:x86/urgent] x86: " tip-bot for Alok Kataria
0 siblings, 1 reply; 4+ messages in thread
From: Alok Kataria @ 2009-09-04 20:13 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Thomas Gleixner, the arch/x86 maintainers, LKML
<snip>...
> 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.
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.
---
Signed-off-by: Alok N Kataria <akataria@vmware.com>
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
+ printk(KERN_WARNING
+ "Failed to get TSC freq from the hypervisor\n");
}
/*
^ permalink raw reply [flat|nested] 4+ messages in thread
* [tip:x86/urgent] x86: Print the hypervisor returned tsc_khz during boot
2009-09-04 20:13 ` Alok Kataria
@ 2009-09-20 18:30 ` tip-bot for Alok Kataria
0 siblings, 0 replies; 4+ messages in thread
From: tip-bot for Alok Kataria @ 2009-09-20 18:30 UTC (permalink / raw)
To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, akataria, tglx, mingo
Commit-ID: 6399c087458859cddff2d6b46befb95b866df3e0
Gitweb: http://git.kernel.org/tip/6399c087458859cddff2d6b46befb95b866df3e0
Author: Alok Kataria <akataria@vmware.com>
AuthorDate: Fri, 4 Sep 2009 13:13:39 -0700
Committer: Ingo Molnar <mingo@elte.hu>
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.
Signed-off-by: Alok N Kataria <akataria@vmware.com>
LKML-Reference: <1252095219.12518.13.camel@ank32.eng.vmware.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
arch/x86/kernel/cpu/vmware.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kernel/cpu/vmware.c b/arch/x86/kernel/cpu/vmware.c
index 0a46b4d..1cbed97 100644
--- a/arch/x86/kernel/cpu/vmware.c
+++ b/arch/x86/kernel/cpu/vmware.c
@@ -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");
}
/*
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-09-20 18:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-24 1:08 [PATCH: x86] Print the hypervisor returned tsc_khz during boot Alok Kataria
2009-09-04 7:49 ` Ingo Molnar
2009-09-04 20:13 ` Alok Kataria
2009-09-20 18:30 ` [tip:x86/urgent] x86: " tip-bot for Alok Kataria
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome