]>
Commit | Line | Data |
---|---|---|
704ffc99 GKH |
1 | From 9f242dc10e0c3c1eb32d8c83c18650a35fd7f80d Mon Sep 17 00:00:00 2001 |
2 | From: Alok Kataria <akataria@vmware.com> | |
3 | Date: Mon, 2 Aug 2010 16:10:37 -0700 | |
4 | Subject: x86, vmware: Preset lpj values when on VMware. | |
5 | ||
6 | From: Alok Kataria <akataria@vmware.com> | |
7 | ||
8 | commit 9f242dc10e0c3c1eb32d8c83c18650a35fd7f80d upstream. | |
9 | ||
10 | When running on VMware's platform, we have seen situations where | |
11 | the AP's try to calibrate the lpj values and fail to get good calibration | |
12 | runs becasue of timing issues. As a result delays don't work correctly | |
13 | on all cpus. | |
14 | ||
15 | The solutions is to set preset_lpj value based on the current tsc frequency | |
16 | value. This is similar to what KVM does as well. | |
17 | ||
18 | Signed-off-by: Alok N Kataria <akataria@vmware.com> | |
19 | LKML-Reference: <1280790637.14933.29.camel@ank32.eng.vmware.com> | |
20 | Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> | |
21 | Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> | |
22 | ||
23 | --- | |
24 | arch/x86/kernel/cpu/vmware.c | 10 +++++++++- | |
25 | 1 file changed, 9 insertions(+), 1 deletion(-) | |
26 | ||
27 | --- a/arch/x86/kernel/cpu/vmware.c | |
28 | +++ b/arch/x86/kernel/cpu/vmware.c | |
29 | @@ -22,6 +22,7 @@ | |
30 | */ | |
31 | ||
32 | #include <linux/dmi.h> | |
33 | +#include <linux/jiffies.h> | |
34 | #include <asm/div64.h> | |
35 | #include <asm/vmware.h> | |
36 | #include <asm/x86_init.h> | |
37 | @@ -50,7 +51,7 @@ static inline int __vmware_platform(void | |
38 | ||
39 | static unsigned long vmware_get_tsc_khz(void) | |
40 | { | |
41 | - uint64_t tsc_hz; | |
42 | + uint64_t tsc_hz, lpj; | |
43 | uint32_t eax, ebx, ecx, edx; | |
44 | ||
45 | VMWARE_PORT(GETHZ, eax, ebx, ecx, edx); | |
46 | @@ -61,6 +62,13 @@ static unsigned long vmware_get_tsc_khz( | |
47 | printk(KERN_INFO "TSC freq read from hypervisor : %lu.%03lu MHz\n", | |
48 | (unsigned long) tsc_hz / 1000, | |
49 | (unsigned long) tsc_hz % 1000); | |
50 | + | |
51 | + if (!preset_lpj) { | |
52 | + lpj = ((u64)tsc_hz * 1000); | |
53 | + do_div(lpj, HZ); | |
54 | + preset_lpj = lpj; | |
55 | + } | |
56 | + | |
57 | return tsc_hz; | |
58 | } | |
59 |