Problem with auto-detecting a HV environment from within Linux

Greg KH greg at kroah.com
Thu Feb 25 17:36:11 UTC 2010


On Thu, Feb 25, 2010 at 05:30:29PM +0000, Haiyang Zhang wrote:
> > From: Greg KH [mailto:greg at kroah.com]
> > So, is there a way to "know" ahead of time if we are in a HV guest
> > environment?
> 
> Here is some info from dmesg, which shows "VRTUAL MICROSFT".
> ACPI: RSDT (v001 VRTUAL MICROSFT 0x03000919 MSFT 0x00000097) @ 0x000000001fff0000
> ACPI: FADT (v002 VRTUAL MICROSFT 0x03000919 MSFT 0x00000097) @ 0x000000001fff0200
> ACPI: WAET (v001 VRTUAL MICROSFT 0x03000919 MSFT 0x00000097) @ 0x000000001fff0b00
> ACPI: SLIC (v001 VRTUAL MICROSFT 0x03000919 MSFT 0x00000097) @ 0x000000001fff0b40
> ACPI: OEM0 (v001 VRTUAL MICROSFT 0x03000919 MSFT 0x00000097) @ 0x000000001fff0d40
> ACPI: SRAT (v002 VRTUAL MICROSFT 0x03000919 MSFT 0x00000097) @ 0x000000001fff0600
> ACPI: MADT (v001 VRTUAL MICROSFT 0x03000919 MSFT 0x00000097) @ 0x000000001fff0300
> ACPI: OEMB (v001 VRTUAL MICROSFT 0x03000919 MSFT 0x00000097) @ 0x000000001ffff240
> ACPI: DSDT (v001 MSFTVM MSFTVM02 0x00000002 INTL 0x02002026) @ 0x0000000000000000

That's a good start, so which device can we key off of here?

What does the following command output in a HV virtual system:
	grep . /sys/bus/acpi/devices/*/modalias

That might give us something that we can use.

How about DMI data?  Does the Host export any info there?  Is there
anything in the /sys/class/dmi/id/ directory?  If so, can you send the
output of:
	cat /sys/class/dmi/id/modalias

And you are sure no PCI devices are present to key off of that are never
going to show up in a "physical" machine?

What do you recommend doing here?

thanks,

greg k-h



More information about the devel mailing list