Skip to content

Commit

Permalink
x86, vmware: Preset lpj values when on VMware.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alok Kataria authored and H. Peter Anvin committed Aug 3, 2010
1 parent 9fe6206 commit 9f242dc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion arch/x86/kernel/cpu/vmware.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
}

Expand Down

0 comments on commit 9f242dc

Please sign in to comment.