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

From: Ingo Molnar
Date: Wed Sep 17 2008 - 10:10:59 EST



* Yan Li <elliot.li.tech@xxxxxxxxx> wrote:

> On Wed, Sep 17, 2008 at 12:52:38PM +0200, Ingo Molnar wrote:
> > > This code is from mtrr_trim_uncached_memory(), and used by
> > > setup_arch(), which is used far before PCI is ready.
> > >
> > > Therefore I think we can only use DMI here. Any idea?
> >
> > PCI quirks can be used almost arbitrarily early stage, see:
> > arch/x86/kernel/early-quirks.c.
> >
> > Adding a VM identification callback to early-quirks.c would be fine. But
> > if there's a reliable and specific enough DMI string that's fine as
> > well. (but PCI is better, since it's a generally more stable enumeration
> > interface)
>
> The problem here is that mtrr_trim_uncached_memory() is called 108
> lines before the invocation of early_quirks(), and 48 lines before
> that of dmi_scan_machine(). That's quite early. The only thing ran
> before that is the initialization of CPU, so we have nearly nothing to
> use to check the fingerprint of the underlying machine.

that still leaves the CPUID/MSR method for the virtualizer to announce
itself.

> I feel It's also unfit to touch the whole PCI or DMI thing before CPU
> registers and memory are settled. A simple solution here is to only
> issue a KERN_INFO when we detected mtrr is empty and later, when we
> can be sure that the OS is not running as a VM, issue a warning. The
> later part can be done in early_quirks().

ok, we can move the MTRR message further back, to after the early quirks
phase.

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/