All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: akataria@vmware.com
Cc: Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
	the arch/x86 maintainers <x86@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Dan Hecht <dhecht@vmware.com>
Subject: Re: [PATCH 2/3] x86: Get TSC frequency from VMware hypervisor.
Date: Mon, 20 Oct 2008 18:52:12 -0700	[thread overview]
Message-ID: <48FD35CC.10904@zytor.com> (raw)
In-Reply-To: <1224552952.2640.93.camel@alok-dev1>

Alok Kataria wrote:
> x86: Get TSC frequency from VMware hypervisor.
> 
> From: Alok N Kataria <akataria@vmware.com>
> 
> This patch adds functions to detect if we are running under VMware.
> The current way to check if we are on VMware is following,
> #  check if "hypervisor present bit" is set, if so read the 0x40000000
>    cpuid leaf and check for "VMwareVMware" signature.
> #  if the above fails, check the DMI vendors name for "VMware" string
>    if we find one we query the VMware backdoor port to check if we are
>    under VMware.
> 
> The DMI + Backdoor check is needed for older VMware products, which
> don't implement the hypervisor signature cpuid leaf.
> Also note that since we are checking for the DMI signature the backdoor
> port would never be accessed on native hardware.
> 
> This patch also adds a hypervisor_get_tsc_freq function, instead of
> calibrating the frequency which can be error prone in virtualized
> environment, we ask the hypervisor for it. We get the frequency from
> the hypervisor by accessing the backdoor port if we are running on VMware.
> Other hypervisors too can add code to get frequency on their platform
> to this routine.
> 

I would like to see, instead of calling vmware_platform() directly in 
places like tsc.c, a hypervisor field in the CPU structure that is set 
with the rest of the CPU identification stuff.  That way we avoid ending 
up with garbage like:

if (vmware_platform() || xen_platform() || kvm_platform() ...)

	-hpa

  reply	other threads:[~2008-10-21  1:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-21  1:35 [PATCH 2/3] x86: Get TSC frequency from VMware hypervisor Alok Kataria
2008-10-21  1:52 ` H. Peter Anvin [this message]
2008-10-21 16:16   ` Alok Kataria
2008-10-21 16:17     ` H. Peter Anvin
2008-10-22 19:22       ` Alok Kataria

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=48FD35CC.10904@zytor.com \
    --to=hpa@zytor.com \
    --cc=akataria@vmware.com \
    --cc=dhecht@vmware.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.