[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1220834216.1837.11.camel@obelisk.thedillows.org>
Date: Sun, 07 Sep 2008 20:36:56 -0400
From: David Dillow <dave@...dillows.org>
To: Yan Li <elliot.li.tech@...il.com>
Cc: linux-kernel@...r.kernel.org, mingo@...e.hu, joerg.roedel@....com,
rjmaomao@...il.com
Subject: Re: [PATCH 1/2] VMware detection support for x86 and x86-64
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists