Bug 5956

Summary: linux-yocto cant boot in qemu when cpu=host
Product: [Yocto Project Subprojects] Kernel Reporter: Khem Raj <raj.khem>
Component: linux-yoctoAssignee: Stefan Stanacar <sstncr>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: sgw, sstncr
Version: 1.6   
Target Milestone: 1.6   
Hardware: x86   
OS: x86_64   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know

Description Khem Raj 2014-03-13 01:34:30 UTC
This bug is actually same for which we did a workaround in bug #3908 this time the problem happens when I try to boot the virtual appliance .vmdk image in virtualbox. Unfortunately virtualbox does not have options to change cpu emulation like qemu-kvm. This issue is still present in current 3.10.x linux-yocto. We need to resolve it properly, since normal upstream kernels are able
to boot normally in virtualbox its a bug in linux-yocto. To reproduce it

apply this patch

--- a/scripts/runqemu-internal
+++ b/scripts/runqemu-internal
@@ -398,7 +398,7 @@ fi
 if [ "$MACHINE" = "qemux86-64" ]; then
     QEMU=qemu-system-x86_64
     if [ "$KVM_ACTIVE" = "yes" ]; then
-        CPU_SUBTYPE=kvm64
+        CPU_SUBTYPE=host
     else
         CPU_SUBTYPE=core2duo
     fi

and then

runqemu qemux86-64 kvm
Comment 1 Stefan Stanacar 2014-03-31 11:49:39 UTC
I think that the right fix to use -cpu host is to include paravirt kernel config for qemux86-64. (this isn't needed for -cpu kvm64 as it is now)
Note that it is enabled for qemux86 but not for x86-64.
The is what we currently have in linux-yocto-3.10.bb:
KERNEL_FEATURES_append_qemux86=" cfg/sound.scc cfg/paravirt_kvm.scc"
KERNEL_FEATURES_append_qemux86-64=" cfg/sound.scc"

That change has been inherited from recipe to recipe since:

http://git.yoctoproject.org/cgit.cgi/poky/commit/meta/recipes-kernel/linux/linux-yocto_3.4.bb?id=e6149ec6c4c14d3a939022cdc29ac94dced836dd

The reason for that commit was that on AB some qemux86-64 failed to shutdown because of the old host kernel. But that's more than a year old commit, and the ABs are now on newer kernels.
So if we want kvm and -cpu host on a host with kernel >=3.8 we should enable that config back.
Comment 2 Darren Hart 2014-03-31 17:30:50 UTC
No objection from me. Have you tested a change? Could you do so and submit a patch?
Comment 3 Stefan Stanacar 2014-04-01 10:02:58 UTC
Patch sent - tested that the image behaves good
  - without kvm
  - with kvm (and the default cpu=kvm64) and
  - with kvm and Khem's change to runqemu (cpu=host)

Have a look on the ML. Btw, I've sent the change for the new linux-yocto-3.14 only, if that matters to anyone.