* [PATCH] Preset lpj values when on VMware.
@ 2010-08-02 23:10 Alok Kataria
2010-08-03 0:21 ` [tip:x86/vmware] x86, vmware: " tip-bot for Alok Kataria
0 siblings, 1 reply; 2+ messages in thread
From: Alok Kataria @ 2010-08-02 23:10 UTC (permalink / raw)
To: Ingo Molnar, H. Peter Anvin, the arch/x86 maintainers
Cc: LKML, Dan Hecht, gcosta
Please consider the patch below for the tip tree. Thanks !
--
When running on VMware's platform, we have seen situations where
the AP's try to calibrate the lpj values and fail to get good calibration
runs becasue of timing issues. As a result delays don't work correctly
on all cpus.
The solutions is to set preset_lpj value based on the current tsc frequency
value. This is similar to what KVM does as well.
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 2010-08-02 15:43:28.000000000 -0700
+++ linux-x86-tree.git/arch/x86/kernel/cpu/vmware.c 2010-08-02 15:43:37.000000000 -0700
@@ -51,7 +51,7 @@ static inline int __vmware_platform(void
static unsigned long vmware_get_tsc_khz(void)
{
- uint64_t tsc_hz;
+ uint64_t tsc_hz, lpj;
uint32_t eax, ebx, ecx, edx;
VMWARE_PORT(GETHZ, eax, ebx, ecx, edx);
@@ -62,6 +62,13 @@ static unsigned long vmware_get_tsc_khz(
printk(KERN_INFO "TSC freq read from hypervisor : %lu.%03lu MHz\n",
(unsigned long) tsc_hz / 1000,
(unsigned long) tsc_hz % 1000);
+
+ if (!preset_lpj) {
+ lpj = ((u64)tsc_hz * 1000);
+ do_div(lpj, HZ);
+ preset_lpj = lpj;
+ }
+
return tsc_hz;
}
^ permalink raw reply [flat|nested] 2+ messages in thread* [tip:x86/vmware] x86, vmware: Preset lpj values when on VMware.
2010-08-02 23:10 [PATCH] Preset lpj values when on VMware Alok Kataria
@ 2010-08-03 0:21 ` tip-bot for Alok Kataria
0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Alok Kataria @ 2010-08-03 0:21 UTC (permalink / raw)
To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, akataria, tglx, hpa
Commit-ID: 9f242dc10e0c3c1eb32d8c83c18650a35fd7f80d
Gitweb: http://git.kernel.org/tip/9f242dc10e0c3c1eb32d8c83c18650a35fd7f80d
Author: Alok Kataria <akataria@vmware.com>
AuthorDate: Mon, 2 Aug 2010 16:10:37 -0700
Committer: H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Mon, 2 Aug 2010 17:16:30 -0700
x86, vmware: Preset lpj values when on VMware.
When running on VMware's platform, we have seen situations where
the AP's try to calibrate the lpj values and fail to get good calibration
runs becasue of timing issues. As a result delays don't work correctly
on all cpus.
The solutions is to set preset_lpj value based on the current tsc frequency
value. This is similar to what KVM does as well.
Signed-off-by: Alok N Kataria <akataria@vmware.com>
LKML-Reference: <1280790637.14933.29.camel@ank32.eng.vmware.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
---
arch/x86/kernel/cpu/vmware.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/arch/x86/kernel/cpu/vmware.c b/arch/x86/kernel/cpu/vmware.c
index b9d1ff5..227b044 100644
--- a/arch/x86/kernel/cpu/vmware.c
+++ b/arch/x86/kernel/cpu/vmware.c
@@ -51,7 +51,7 @@ static inline int __vmware_platform(void)
static unsigned long vmware_get_tsc_khz(void)
{
- uint64_t tsc_hz;
+ uint64_t tsc_hz, lpj;
uint32_t eax, ebx, ecx, edx;
VMWARE_PORT(GETHZ, eax, ebx, ecx, edx);
@@ -62,6 +62,13 @@ static unsigned long vmware_get_tsc_khz(void)
printk(KERN_INFO "TSC freq read from hypervisor : %lu.%03lu MHz\n",
(unsigned long) tsc_hz / 1000,
(unsigned long) tsc_hz % 1000);
+
+ if (!preset_lpj) {
+ lpj = ((u64)tsc_hz * 1000);
+ do_div(lpj, HZ);
+ preset_lpj = lpj;
+ }
+
return tsc_hz;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-08-03 0:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-02 23:10 [PATCH] Preset lpj values when on VMware Alok Kataria
2010-08-03 0:21 ` [tip:x86/vmware] x86, vmware: " 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
all inboxes | Powered by JetHome®