Bug 116731 - KVM guest fails to boot OVMF firmware with SMP enabled
Summary: KVM guest fails to boot OVMF firmware with SMP enabled
Status: RESOLVED CODE_FIX
Alias: None
Product: Virtualization
Classification: Unclassified
Component: kvm (show other bugs)
Hardware: x86-64 Linux
: P1 normal
Assignee: virtualization_kvm
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-19 17:46 UTC by jonathan.n.boeing
Modified: 2016-06-10 06:38 UTC (History)
3 users (show)

See Also:
Kernel Version: 4.2 and later
Subsystem:
Regression: No
Bisected commit-id:


Attachments
Partial revert of d28bc9d for current KVM. (816 bytes, patch)
2016-04-19 20:53 UTC, Radim Krčmář
Details | Diff

Description jonathan.n.boeing 2016-04-19 17:46:59 UTC
If I enable SMP and an OVMF firmware in my VM, QEMU either hangs at boot or dies with the error message: KVM: entry failed, hardware error 0x80000021

A minimal QEMU command line to repro is:

qemu-system-x86_64 -enable-kvm -smp cpus=2 -drive if=pflash,format=raw,file=OVMF.fd

Running host kernel 4.4.6, and I bisected the failure to OVMF commit 94941c8: UefiCpuPkg: CpuDxe: broadcast MTRR changes to APs

Doing some debugging, I built the latest OVMF from git and bisected the failure to kernel commit (merged for 4.2rc1) d28bc9d: KVM: x86: INIT and reset sequences are different

To clarify, the failing config is:
Host kernel d28bc9d+ (~4.2rc1), OVMF 94941c8+, and SMP enabled

Working configs are:
Host kernels 4.1-4.4, OVMF tip, and SMP disabled
Host kernels 4.1-4.4, SeaBIOS (instead of OVMF), and SMP enabled
Host kernel 4.1, OVMF tip, and SMP enabled
Host kernels 4.1-4.4, OVMF prior to 94941c8, and SMP enabled

The host system is running a quad-core Intel Penryn CPU (which supports VMX but not EPT). Per OVMF dev Laszlo Ersek, the failure is related to lacking EPT support.
Comment 1 Radim Krčmář 2016-04-19 20:53:37 UTC
Created attachment 213331 [details]
Partial revert of d28bc9d for current KVM.

Does the guest boot if you apply the attached patch on top of current KVM?

And if you discard the "init_event = false;" hunk from the patch?

Thanks.
Comment 2 jonathan.n.boeing 2016-04-19 22:04:57 UTC
I tested against mainline 4.4.7, is that ok? Otherwise, by "current KVM" do you mean from git://git.kernel.org/pub/scm/virt/kvm/kvm.git ?

With the full patch applied, the guest failed to boot.

With just the bottom hunk applied, the guest booted.
Comment 3 Radim Krčmář 2016-04-22 14:35:39 UTC
4.4.7 is ok, thank you for testing!   Yes, current KVM is that one.  Latest Linus' tree counts too.

The patch is bad as I erroneously didn't revert the "vmx->vcpu.arch.cr0 = cr0;" line and cr0 is not initialized there ... the shame made me build OVMF and I tried to reproduce on latest unpatched KVM and it worked fine -- does it work for you too?

Thanks.
Comment 4 jonathan.n.boeing 2016-04-22 22:08:03 UTC
I built from commit 5e1b59a in kvm/master and the guest was unable to boot.
Comment 5 Laszlo Ersek 2016-06-07 18:50:35 UTC
Radim,

am I right to think that this is fixed by commit f24632475d4f in v4.7-rc1, and by commit 3bae61327149 in v4.6.1?

If that's the case, we should probably close this report.

Thanks!
Laszlo
Comment 6 Paolo Bonzini 2016-06-08 11:04:18 UTC
Yes, you're right.
Comment 7 jonathan.n.boeing 2016-06-10 06:38:36 UTC
I confirmed it's working on 4.6.2

Thanks!

Note You need to log in before you can comment on or make changes to this bug.