[CentOS-virt] Xen PV domU reported as Xen-HVM

George Dunlap dunlapg at umich.edu
Tue Jun 17 09:36:38 UTC 2014


On Thu, Jun 12, 2014 at 11:23 PM, Karl Johnson <karljohnson.it at gmail.com> wrote:
> Hello,
>
> I am running two dom0s, one on CentOS 5 with Xen 4.1.2 (from Gitco) and the
> other one on CentOS 6 with Xen 4.2.4 (from Xen4CentOS). I host one LVM based
> domU on both from the same template (CentOS 6 PV) with the same Xen config
> (see below). However, the domU on Xen 4.1 reports itself as Xen PV while the
> domU on Xen4CentOS reports itself as Xen HVM.
>
>
> == First domU ==
>
> virt-what and cPanel scripts report domU as: xenpv
>
> dom0: 2.6.18-371.6.1.el5xen Xen 4.1.2
>
> domU Config:
>
> bootloader = '/usr/bin/pygrub'
> extra      = ''
> memory     = 6144
> hostname   = 'web2.x.ca'
> cpu_weight = 256
> name       = 'vm115'
> vif        = ['ip=205.X.X.X, vifname=vifvm115.0, mac=00:16:3e:7a:X:X']
> vnc        = 0
> vcpus      = 6
> vncviewer  = 0
> serial     = 'pty'
> disk       = ['phy:/dev/xen/vm115_img,xvda1,w',
> 'phy:/dev/xen/vm115_swap,xvda2,w']
>
> domU kernel: 2.6.32-431.5.1.el6.x86_64
>
> root at web2 [~]# virt-what
> xen
> root at web2 [~]#
>
>
>
> == Second domU ==
>
> virt-what and cPanel scripts report domU as: xenhvm
>
> dom0: 3.10.32-11.el6.centos.alt.x86_64  Xen 4.2.4-29.el6
>
> domU Config:
>
> bootloader = '/usr/bin/pygrub'
> extra      = ''
> memory     = 6144
> hostname   = 'web3.x.ca'
> cpu_weight = 256
> name       = 'vm116'
> vif        = ['ip=205.X.X.X, vifname=vifvm116.0, mac=00:16:3e:cf:X:X']
> vnc        = 0
> vcpus      = 6
> vncviewer  = 0
> serial     = 'pty'
> disk       = ['phy:/dev/xen/vm116_img,xvda1,w',
> 'phy:/dev/xen/vm116_swap,xvda2,w']
>
> domU kernel: 2.6.32-431.5.1.el6.x86_64
>
> root at web3 [~]# virt-what
> xen
> xen-hvm
> root at web3 [~]#
>
> Any idea why?

A lot of these tools use quirks of the hypervisor to detect these
kinds of changes.  One such quirk in Xen PV is handling of the CPUID
instruction: normally there's no way to trap the CPUID instruction in
PV mode, so Xen introduced a special PV CPUID (which is just an
illegal instruction that Xen recognizes and emulates itself)  that the
kernel is supposed to use instead; but that's an opt-in thing -- you
can still execute the normal CPUID.  By executing the PV CPUID and the
normal CPUID and comparing the results, you can tell if you're in a PV
or an HVM VM.

However, on recent architectures Intel has introduced functionality to
allow trapping os CPUID even in non-HVM mode.  Support for this went
into 4.2.  Now, if you have the right hardware, and the right Xen
version, you'll get the same results whether you execute the PV CPUID
or the native one.

So virt-what's trick of comparing the two CPUID results to determine
if you're in a PV or an HVM domain doesn't work anymore.

 -George


More information about the CentOS-virt mailing list