<div dir="ltr">Please see comments below,<div><br></div><div>Cheers,</div><div>Alex</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Apr 15, 2013 at 1:49 PM, Iorga, Cristian <span dir="ltr">&lt;<a href="mailto:cristian.iorga@intel.com" target="_blank">cristian.iorga@intel.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Alex,<br>
<br>
See my comments below.<br>
<br>
Regards,<br>
Cristian<br>
<br>
From: Damian, Alexandru [mailto:<a href="mailto:alexandru.damian@intel.com">alexandru.damian@intel.com</a>]<br>
Sent: Monday, April 15, 2013 3:31 PM<br>
To: Iorga, Cristian<br>
Cc: <a href="mailto:richard.purdie@linuxfoundation.org">richard.purdie@linuxfoundation.org</a>; <a href="mailto:tom.zanussi@linux.intel.com">tom.zanussi@linux.intel.com</a>; Burton, Ross; <a href="mailto:paul.eggleton@linux.intel.com">paul.eggleton@linux.intel.com</a>; <a href="mailto:openembedded-core@lists.openembedded.org">openembedded-core@lists.openembedded.org</a><br>

Subject: Re: [OE-core] [PATCH] qemu: use default qemu CPU definition<br>
<div class="im"><br>
Hi Cristian,<br>
<br>
Please do post comments on patch on the mailing list.<br>
<br>
Regarding the message itself, quoted below, I am addressing your specific concerns.<br>
- There is no performance impact between &quot;qemu64&quot; and &quot;host&quot; CPU options. The only thing changing is the level of private instructions that the kernel will attempt - which should be clearly restricted to &quot;qemu64&quot; and not &quot;host&quot; since we build Yocto for the &quot;qemu&quot; machine.<br>

</div>               Agree.<br>
<div class="im">- I agree that there is an underlying problem in the kernel, but that is not our primary concern, see no 1. It might be our concern if we&#39;d build for a specific BSP which showed the problem, but as it stands, it&#39;s KVM folk&#39;s concern. Funny enough, they know about the problem (I tracked on their mailing list), but they don&#39;t have a fix since it runs as it&#39;s designed right now - that is, the faulty behavior is a result of how it should work with the current design.<br>

</div>               I don’t know the problems exactly in this case, but:<br>
<br>
-        I suggested that the differences between how this issue is reproducible or not of different host kernels is strange, and I fail to see the logical connection between your patch and the aforementioned behaviors. Can you please provide an explanation?<br>

<br>
-        It is also strange that this issue is reproducible only on qemux86-64 and not on qemux86 (qemux86 also exports CPU of the VM as host CPU), which suggests a different root cause.<br></blockquote><div><br></div><div>
<br></div><div style>The root cause is this: on specific CPU hosts, the kernel is trying to execute a &quot;read model specific register&quot; instruction. This is not handled by the qemu, and it&#39;s executed directly by host in KVM emulation mode. This triggers a GP0 fault, as designed, since it&#39;s not executed in ring 0 - it&#39;s executed in ring 3 since KVM is executing in userspace. So the guest now executes a GP0 handler which stops the guest machine.</div>
<div style><br></div><div style>The fix is actually preventing execution of the RDMSR/WRMSR instructions in KVM mode since the guest kernel know knows it&#39;s under emulation.   </div><div> </div><div style>This is what I mean that the system actually works as designed.</div>
<div style><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
I still recommend merging this patch since it fixes the problem with the right fix.<br>
<br>
</div>-        That’s a fix, but is it the right one, given my previous observations?<br></blockquote><div><br></div><div style>Yes, it is. </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
Also, may I remind you that this a regression?<br>
This issue was not present with the same kernel, on the same distro and it is not present on qemux86 VMs.<br>
<div class="im"><br>
Cheers,<br>
Alex<br>
<br>
Original message:<br>
<br>
Hi Alex,<br>
<br>
I might be wrong, and I need more time to investigate, but I don&#39;t agree with the fix you proposed for this issue.<br>
<br>
<br>
<br>
What you propose is just a step back from how qemu should optimally work, meaning exporting &quot;-cpu host&quot;.<br>
<br>
<br>
<br>
That&#39;s one thing.<br>
<br>
<br>
<br>
Another thing is the described issue seems to be specific to some kernels on the host.<br>
<br>
For example, I checked with LaurP and AlexG and thes issue is:<br>
<br>
- reproducible on Ubuntu 12.10 with kernel 3.5.0.27 and Fedora Core 18 with kernel 3.8.5.<br>
<br>
- not reproducible with Ubuntu 12.04 with kernel 3.2.x (need to check the exact details with LaurP).<br>
<br>
<br>
<br>
This issue needs more investigation.<br>
<br>
<br>
<br>
Regards,<br>
<br>
Cristian<br>
<br>
</div><div class="im">On Mon, Apr 15, 2013 at 9:58 AM, Iorga, Cristian &lt;<a href="mailto:cristian.iorga@intel.com">cristian.iorga@intel.com</a>&lt;mailto:<a href="mailto:cristian.iorga@intel.com">cristian.iorga@intel.com</a>&gt;&gt; wrote:<br>

Hi Alex,<br>
<br>
See my comments regarding this patch at:<br>
<a href="https://bugzilla.yoctoproject.org/show_bug.cgi?id=3908" target="_blank">https://bugzilla.yoctoproject.org/show_bug.cgi?id=3908</a><br>
<br>
Regards,<br>
Cristian<br>
<br>
-----Original Message-----<br>
</div><div class="im">From: <a href="mailto:openembedded-core-bounces@lists.openembedded.org">openembedded-core-bounces@lists.openembedded.org</a>&lt;mailto:<a href="mailto:openembedded-core-bounces@lists.openembedded.org">openembedded-core-bounces@lists.openembedded.org</a>&gt; [mailto:<a href="mailto:openembedded-core-bounces@lists.openembedded.org">openembedded-core-bounces@lists.openembedded.org</a>&lt;mailto:<a href="mailto:openembedded-core-bounces@lists.openembedded.org">openembedded-core-bounces@lists.openembedded.org</a>&gt;] On Behalf Of Alex DAMIAN<br>

Sent: Tuesday, April 09, 2013 5:47 PM<br>
</div><div class="im">To: <a href="mailto:richard.purdie@linuxfoundation.org">richard.purdie@linuxfoundation.org</a>&lt;mailto:<a href="mailto:richard.purdie@linuxfoundation.org">richard.purdie@linuxfoundation.org</a>&gt;; <a href="mailto:tom.zanussi@linux.intel.com">tom.zanussi@linux.intel.com</a>&lt;mailto:<a href="mailto:tom.zanussi@linux.intel.com">tom.zanussi@linux.intel.com</a>&gt;; Burton, Ross; <a href="mailto:paul.eggleton@linux.intel.com">paul.eggleton@linux.intel.com</a>&lt;mailto:<a href="mailto:paul.eggleton@linux.intel.com">paul.eggleton@linux.intel.com</a>&gt;; <a href="mailto:openembedded-core@lists.openembedded.org">openembedded-core@lists.openembedded.org</a>&lt;mailto:<a href="mailto:openembedded-core@lists.openembedded.org">openembedded-core@lists.openembedded.org</a>&gt;<br>

Cc: Damian, Alexandru<br>
Subject: [OE-core] [PATCH] qemu: use default qemu CPU definition<br>
<br>
</div>From: Alexandru DAMIAN &lt;<a href="mailto:alexandru.damian@intel.com">alexandru.damian@intel.com</a>&lt;mailto:<a href="mailto:alexandru.damian@intel.com">alexandru.damian@intel.com</a>&gt;&gt;<br>
<div class="im"><br>
This fixes guest crashes when trying to use restricted instructions based on CPU description. Using default qemu CPU descriptions restrict faults on using restricted model-specific registers.<br>
<br>
[YOCTO #3908]<br>
<br>
</div>Signed-off-by: Alexandru DAMIAN &lt;<a href="mailto:alexandru.damian@intel.com">alexandru.damian@intel.com</a>&lt;mailto:<a href="mailto:alexandru.damian@intel.com">alexandru.damian@intel.com</a>&gt;&gt;<br>
<div><div class="h5">---<br>
 scripts/runqemu          |    2 +-<br>
 scripts/runqemu-internal |    6 ++++--<br>
 2 files changed, 5 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/scripts/runqemu b/scripts/runqemu index 8ed1226..43d7600 100755<br>
--- a/scripts/runqemu<br>
+++ b/scripts/runqemu<br>
@@ -261,7 +261,7 @@ if [ &quot;x$KVM_ENABLED&quot; = &quot;xyes&quot; ]; then<br>
         exit 1;<br>
     fi<br>
     if [ -w /dev/kvm -a -r /dev/kvm ]; then<br>
-        SCRIPT_QEMU_OPT=&quot;$SCRIPT_QEMU_OPT -enable-kvm -cpu host&quot;<br>
+        SCRIPT_QEMU_OPT=&quot;$SCRIPT_QEMU_OPT -enable-kvm &quot;<br>
         KVM_ACTIVE=&quot;yes&quot;<br>
     else<br>
         echo &quot;You have no rights on /dev/kvm.&quot;<br>
diff --git a/scripts/runqemu-internal b/scripts/runqemu-internal index e8191d1..a7813e5 100755<br>
--- a/scripts/runqemu-internal<br>
+++ b/scripts/runqemu-internal<br>
@@ -323,10 +323,11 @@ fi<br>
<br>
 if [ &quot;$MACHINE&quot; = &quot;qemux86&quot; ]; then<br>
     QEMU=qemu-system-i386<br>
+    QEMU_CPU_OPTIONS=&quot;-cpu qemu32&quot;<br>
     QEMU_UI_OPTIONS=&quot;$QEMU_UI_OPTIONS -vga vmware&quot;<br>
     if [ &quot;$FSTYPE&quot; = &quot;ext2&quot; -o &quot;$FSTYPE&quot; = &quot;ext3&quot; -o &quot;$FSTYPE&quot; = &quot;btrfs&quot; ]; then<br>
         KERNCMDLINE=&quot;vga=0 uvesafb.mode_option=640x480-32 root=$DROOT rw mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD&quot;<br>
-        QEMUOPTIONS=&quot;$QEMU_NETWORK_CMD $ROOTFS_OPTIONS $QEMU_UI_OPTIONS&quot;<br>
+        QEMUOPTIONS=&quot;$QEMU_NETWORK_CMD $ROOTFS_OPTIONS $QEMU_CPU_OPTIONS $QEMU_UI_OPTIONS&quot;<br>
     fi<br>
     if [ &quot;$FSTYPE&quot; = &quot;nfs&quot; ]; then<br>
         if [ &quot;$NFS_SERVER&quot; = &quot;192.168.7.1&quot; -a ! -d &quot;$NFS_DIR&quot; ]; then @@ -347,10 +348,11 @@ fi<br>
<br>
 if [ &quot;$MACHINE&quot; = &quot;qemux86-64&quot; ]; then<br>
     QEMU=qemu-system-x86_64<br>
+    QEMU_CPU_OPTIONS=&quot;-cpu qemu64&quot;<br>
     QEMU_UI_OPTIONS=&quot;$QEMU_UI_OPTIONS -vga vmware&quot;<br>
     if [ &quot;$FSTYPE&quot; = &quot;ext3&quot; -o &quot;$FSTYPE&quot; = &quot;btrfs&quot; ]; then<br>
         KERNCMDLINE=&quot;vga=0 root=$DROOT rw mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD&quot;<br>
-        QEMUOPTIONS=&quot;$QEMU_NETWORK_CMD $ROOTFS_OPTIONS $QEMU_UI_OPTIONS&quot;<br>
+        QEMUOPTIONS=&quot;$QEMU_NETWORK_CMD $ROOTFS_OPTIONS $QEMU_CPU_OPTIONS $QEMU_UI_OPTIONS&quot;<br>
     fi<br>
     if [ &quot;$FSTYPE&quot; = &quot;nfs&quot; ]; then<br>
         if [ &quot;x$ROOTFS&quot; = &quot;x&quot; ]; then<br>
--<br>
1.7.10.4<br>
<br>
_______________________________________________<br>
Openembedded-core mailing list<br>
</div></div><a href="mailto:Openembedded-core@lists.openembedded.org">Openembedded-core@lists.openembedded.org</a>&lt;mailto:<a href="mailto:Openembedded-core@lists.openembedded.org">Openembedded-core@lists.openembedded.org</a>&gt;<br>

<a href="http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core" target="_blank">http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core</a><br>
<br>
</blockquote></div><br></div></div>