lkml.org 
[lkml]   [2008]   [Sep]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/2] VMware detection support for x86 and x86-64
From
Date
On Mon, 2008-09-08 at 07:45 +0800, Yan Li wrote:
> +int is_vmware_guest(void)
> +{
> + u32 version[3];
> +
> + getVersion(&version[0]);
> +
> + if (version[1] != BDOOR_MAGIC) {
> + /* Incorrect virtual machine version */
> + return 0;
> + }
> +
> + if (version[0] != VERSION_MAGIC) {
> + /* Incorrect version magic */
> + return 0;
> + }
> +
> + /* Yes, we are running as VMware Guest */
> + printk(KERN_INFO "vmware detected\n");
> + return 1;
> +}

If you want this to be used by more callsites, it probably doesn't make
sense to have it print out a message each time.

In fact would it make more sense to have a framework (cpu feature flag?)
to detect that we're in any virtualized environment and make this one of
the detection routines, and perhaps cache the result. Especially if this
detection would be used to manage anything near a hot-path in the page
cache as you suggested.

But maybe that's overkill.



\
 
 \ /
  Last update: 2008-09-08 02:39    [W:0.073 / U:3.124 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site