Re: [PATCH 1/2] VMware detection support for x86 and x86-64

Yan Li
2008-09-08T01:49:54Z

On Sun, Sep 07, 2008 at 08:36:56PM -0400, David Dillow wrote:
> On Mon, 2008-09-08 at 07:45 +0800, Yan Li wrote:
> > +int is_vmware_guest(void)
> > +{
> > skipped....
> > + /* 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.

Sure. Another possible solution is to print that message at the first
call only, it's good for debugging to keep that in dmesg.

If it's not possible to do live migration in/out of a running VMware
environment, we can also safely do this detection only at the first
call to reduce overhead.

> 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.

That sounds good too. And I think the current routines for detecting
KVM, Xen and VMWare are all ready. I can do that if there are more
positive feedbacks.

Thanks.

--
Li, Yan

"Everything that is really great and inspiring is created by the
individual who can labor in freedom."
- Albert Einstein, in Out of My Later Years (1950)