<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Jun 17, 2014 at 5:36 AM, George Dunlap <span dir="ltr"><<a href="mailto:dunlapg@umich.edu" target="_blank">dunlapg@umich.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class=""><div class="h5">On Thu, Jun 12, 2014 at 11:23 PM, Karl Johnson <<a href="mailto:karljohnson.it@gmail.com">karljohnson.it@gmail.com</a>> wrote:<br>

> Hello,<br>
><br>
> I am running two dom0s, one on CentOS 5 with Xen 4.1.2 (from Gitco) and the<br>
> other one on CentOS 6 with Xen 4.2.4 (from Xen4CentOS). I host one LVM based<br>
> domU on both from the same template (CentOS 6 PV) with the same Xen config<br>
> (see below). However, the domU on Xen 4.1 reports itself as Xen PV while the<br>
> domU on Xen4CentOS reports itself as Xen HVM.<br>
><br>
><br>
> == First domU ==<br>
><br>
> virt-what and cPanel scripts report domU as: xenpv<br>
><br>
> dom0: 2.6.18-371.6.1.el5xen Xen 4.1.2<br>
><br>
> domU Config:<br>
><br>
> bootloader = '/usr/bin/pygrub'<br>
> extra      = ''<br>
> memory     = 6144<br>
> hostname   = '<a href="http://web2.x.ca" target="_blank">web2.x.ca</a>'<br>
> cpu_weight = 256<br>
> name       = 'vm115'<br>
> vif        = ['ip=205.X.X.X, vifname=vifvm115.0, mac=00:16:3e:7a:X:X']<br>
> vnc        = 0<br>
> vcpus      = 6<br>
> vncviewer  = 0<br>
> serial     = 'pty'<br>
> disk       = ['phy:/dev/xen/vm115_img,xvda1,w',<br>
> 'phy:/dev/xen/vm115_swap,xvda2,w']<br>
><br>
> domU kernel: 2.6.32-431.5.1.el6.x86_64<br>
><br>
> root@web2 [~]# virt-what<br>
> xen<br>
> root@web2 [~]#<br>
><br>
><br>
><br>
> == Second domU ==<br>
><br>
> virt-what and cPanel scripts report domU as: xenhvm<br>
><br>
> dom0: <a href="tel:3.10.32-11" value="+13103211">3.10.32-11</a>.el6.centos.alt.x86_64  Xen 4.2.4-29.el6<br>
><br>
> domU Config:<br>
><br>
> bootloader = '/usr/bin/pygrub'<br>
> extra      = ''<br>
> memory     = 6144<br>
> hostname   = '<a href="http://web3.x.ca" target="_blank">web3.x.ca</a>'<br>
> cpu_weight = 256<br>
> name       = 'vm116'<br>
> vif        = ['ip=205.X.X.X, vifname=vifvm116.0, mac=00:16:3e:cf:X:X']<br>
> vnc        = 0<br>
> vcpus      = 6<br>
> vncviewer  = 0<br>
> serial     = 'pty'<br>
> disk       = ['phy:/dev/xen/vm116_img,xvda1,w',<br>
> 'phy:/dev/xen/vm116_swap,xvda2,w']<br>
><br>
> domU kernel: 2.6.32-431.5.1.el6.x86_64<br>
><br>
> root@web3 [~]# virt-what<br>
> xen<br>
> xen-hvm<br>
> root@web3 [~]#<br>
><br>
> Any idea why?<br>
<br>
</div></div>A lot of these tools use quirks of the hypervisor to detect these<br>
kinds of changes.  One such quirk in Xen PV is handling of the CPUID<br>
instruction: normally there's no way to trap the CPUID instruction in<br>
PV mode, so Xen introduced a special PV CPUID (which is just an<br>
illegal instruction that Xen recognizes and emulates itself)  that the<br>
kernel is supposed to use instead; but that's an opt-in thing -- you<br>
can still execute the normal CPUID.  By executing the PV CPUID and the<br>
normal CPUID and comparing the results, you can tell if you're in a PV<br>
or an HVM VM.<br>
<br>
However, on recent architectures Intel has introduced functionality to<br>
allow trapping os CPUID even in non-HVM mode.  Support for this went<br>
into 4.2.  Now, if you have the right hardware, and the right Xen<br>
version, you'll get the same results whether you execute the PV CPUID<br>
or the native one.<br>
<br>
So virt-what's trick of comparing the two CPUID results to determine<br>
if you're in a PV or an HVM domain doesn't work anymore.<br>
<br>
 -George<br></blockquote></div><br><div>Thanks for the reply George. Is there any other easy way in the domU to know if it's a pv or hvm with Xen 4.2+ and the right hardware?<br><br></div>Karl <br></div></div>