From: Alok Kataria <akataria@vmware.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
Andi Kleen <andi@firstfloor.org>,
LKML <linux-kernel@vger.kernel.org>,
the arch/x86 maintainers <x86@kernel.org>,
Daniel Hecht <dhecht@vmware.com>
Subject: Re: [PATCH 2/4] Hypervisor detection and get tsc_freq from hypervisor
Date: Mon, 03 Nov 2008 11:31:28 -0800 [thread overview]
Message-ID: <1225740688.8168.41.camel@alok-dev1> (raw)
In-Reply-To: <1225129306.28018.9.camel@alok-dev1>
Hi,
The patch below fixes a problem with the implementation of
vmware_get_tsc_khz.
Please pick this patch too.
Thanks,
Alok
--
x86-VMware: Fix vmware_get_tsc code
From: Alok N Kataria <akataria@vmware.com>
The current version of the code to get the tsc frequency from
the VMware hypervisor, will be broken on processor with frequency
(4G-1) HZ, because on such processors eax will have UINT_MAX
and that would be legitimate.
We instead check that EBX did change to decide if we were able to
read the frequency from the hypervisor.
Signed-off-by: Alok N Kataria <akataria@vmware.com>
---
arch/x86/kernel/cpu/vmware.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/cpu/vmware.c b/arch/x86/kernel/cpu/vmware.c
index 89bc346..b781e50 100644
--- a/arch/x86/kernel/cpu/vmware.c
+++ b/arch/x86/kernel/cpu/vmware.c
@@ -36,7 +36,7 @@
"=a"(eax), "=c"(ecx), "=d"(edx), "=b"(ebx) : \
"0"(VMWARE_HYPERVISOR_MAGIC), \
"1"(VMWARE_PORT_CMD_##cmd), \
- "2"(VMWARE_HYPERVISOR_PORT), "3"(0) : \
+ "2"(VMWARE_HYPERVISOR_PORT), "3"(UINT_MAX) : \
"memory");
static inline int __vmware_platform(void)
@@ -53,7 +53,7 @@ static unsigned long __vmware_get_tsc_khz(void)
VMWARE_PORT(GETHZ, eax, ebx, ecx, edx);
- if (eax == (uint32_t)-1)
+ if (ebx == UINT_MAX)
return 0;
tsc_hz = eax | (((uint64_t)ebx) << 32);
do_div(tsc_hz, 1000);
next prev parent reply other threads:[~2008-11-03 19:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-25 0:21 [PATCH 2/4] Hypervisor detection and get tsc_freq from hypervisor Alok Kataria
2008-10-27 11:01 ` Ingo Molnar
2008-10-27 17:41 ` Alok Kataria
2008-11-03 19:31 ` Alok Kataria [this message]
2008-11-10 12:38 ` Mark McLoughlin
2008-11-10 15:32 ` H. Peter Anvin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1225740688.8168.41.camel@alok-dev1 \
--to=akataria@vmware.com \
--cc=andi@firstfloor.org \
--cc=dhecht@vmware.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox