<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">&lt;<a href="mailto:dunlapg@umich.edu" target="_blank">dunlapg@umich.edu</a>&gt;</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 &lt;<a href="mailto:karljohnson.it@gmail.com">karljohnson.it@gmail.com</a>&gt; wrote:<br>

&gt; Hello,<br>
&gt;<br>
&gt; I am running two dom0s, one on CentOS 5 with Xen 4.1.2 (from Gitco) and the<br>
&gt; other one on CentOS 6 with Xen 4.2.4 (from Xen4CentOS). I host one LVM based<br>
&gt; domU on both from the same template (CentOS 6 PV) with the same Xen config<br>
&gt; (see below). However, the domU on Xen 4.1 reports itself as Xen PV while the<br>
&gt; domU on Xen4CentOS reports itself as Xen HVM.<br>
&gt;<br>
&gt;<br>
&gt; == First domU ==<br>
&gt;<br>
&gt; virt-what and cPanel scripts report domU as: xenpv<br>
&gt;<br>
&gt; dom0: 2.6.18-371.6.1.el5xen Xen 4.1.2<br>
&gt;<br>
&gt; domU Config:<br>
&gt;<br>
&gt; bootloader = &#39;/usr/bin/pygrub&#39;<br>
&gt; extra      = &#39;&#39;<br>
&gt; memory     = 6144<br>
&gt; hostname   = &#39;<a href="http://web2.x.ca" target="_blank">web2.x.ca</a>&#39;<br>
&gt; cpu_weight = 256<br>
&gt; name       = &#39;vm115&#39;<br>
&gt; vif        = [&#39;ip=205.X.X.X, vifname=vifvm115.0, mac=00:16:3e:7a:X:X&#39;]<br>
&gt; vnc        = 0<br>
&gt; vcpus      = 6<br>
&gt; vncviewer  = 0<br>
&gt; serial     = &#39;pty&#39;<br>
&gt; disk       = [&#39;phy:/dev/xen/vm115_img,xvda1,w&#39;,<br>
&gt; &#39;phy:/dev/xen/vm115_swap,xvda2,w&#39;]<br>
&gt;<br>
&gt; domU kernel: 2.6.32-431.5.1.el6.x86_64<br>
&gt;<br>
&gt; root@web2 [~]# virt-what<br>
&gt; xen<br>
&gt; root@web2 [~]#<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; == Second domU ==<br>
&gt;<br>
&gt; virt-what and cPanel scripts report domU as: xenhvm<br>
&gt;<br>
&gt; 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>
&gt;<br>
&gt; domU Config:<br>
&gt;<br>
&gt; bootloader = &#39;/usr/bin/pygrub&#39;<br>
&gt; extra      = &#39;&#39;<br>
&gt; memory     = 6144<br>
&gt; hostname   = &#39;<a href="http://web3.x.ca" target="_blank">web3.x.ca</a>&#39;<br>
&gt; cpu_weight = 256<br>
&gt; name       = &#39;vm116&#39;<br>
&gt; vif        = [&#39;ip=205.X.X.X, vifname=vifvm116.0, mac=00:16:3e:cf:X:X&#39;]<br>
&gt; vnc        = 0<br>
&gt; vcpus      = 6<br>
&gt; vncviewer  = 0<br>
&gt; serial     = &#39;pty&#39;<br>
&gt; disk       = [&#39;phy:/dev/xen/vm116_img,xvda1,w&#39;,<br>
&gt; &#39;phy:/dev/xen/vm116_swap,xvda2,w&#39;]<br>
&gt;<br>
&gt; domU kernel: 2.6.32-431.5.1.el6.x86_64<br>
&gt;<br>
&gt; root@web3 [~]# virt-what<br>
&gt; xen<br>
&gt; xen-hvm<br>
&gt; root@web3 [~]#<br>
&gt;<br>
&gt; 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&#39;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&#39;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&#39;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&#39;ll get the same results whether you execute the PV CPUID<br>
or the native one.<br>
<br>
So virt-what&#39;s trick of comparing the two CPUID results to determine<br>
if you&#39;re in a PV or an HVM domain doesn&#39;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&#39;s a pv or hvm with Xen 4.2+ and the right hardware?<br><br></div>Karl <br></div></div>