Skip to contentSkip to conversation

New: KVM guest fails to boot OVMF firmware with SMP enabled

Bug 116731 [email protected] 1 participant 9 messages Apr 19, 2016 – Jun 10, 2016 KVM

lore
Share & tools
lore
#0 lore raw

https://bugzilla.kernel.org/show_bug.cgi?id=116731

Bug ID: 116731
Summary: KVM guest fails to boot OVMF firmware with SMP enabled
Product: Virtualization
Version: unspecified
Kernel Version: 4.2 and later
Hardware: x86-64
OS: Linux
Tree: Mainline
Status: NEW
Severity: normal
Priority: P1
Component: kvm
Assignee: [email protected]
Reporter: [email protected]
Regression: No

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.

Signature · 2 lines
You are receiving this mail because:
You are watching the assignee of the bug.
#2 lore raw

[Bug 116731] KVM guest fails to boot OVMF firmware with SMP enabled

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=116731

--- Comment #1 from Radim Krčmář <[email protected]> --- Created attachment 213331
--> https://bugzilla.kernel.org/attachment.cgi?id=213331&action=edit
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.

Signature · 2 lines
You are receiving this mail because:
You are watching the assignee of the bug.
#3 lore raw

[Bug 116731] KVM guest fails to boot OVMF firmware with SMP enabled

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=116731

--- Comment #2 from [email protected] ---
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.

Signature · 2 lines
You are receiving this mail because:
You are watching the assignee of the bug.
#4 lore raw

[Bug 116731] KVM guest fails to boot OVMF firmware with SMP enabled

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=116731

--- Comment #3 from Radim Krčmář <[email protected]> ---
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.

Signature · 2 lines
You are receiving this mail because:
You are watching the assignee of the bug.
#6 lore raw

[Bug 116731] KVM guest fails to boot OVMF firmware with SMP enabled

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=116731

--- Comment #5 from Laszlo Ersek <[email protected]> --- 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

Signature · 2 lines
You are receiving this mail because:
You are watching the assignee of the bug.
#7 lore raw

[Bug 116731] KVM guest fails to boot OVMF firmware with SMP enabled

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=116731

Paolo Bonzini <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

             Status|NEW                         |RESOLVED
                 CC|                            |[email protected]
         Resolution|---                         |CODE_FIX

--- Comment #6 from Paolo Bonzini <[email protected]> --- Yes, you're right.

Signature · 2 lines
You are receiving this mail because:
You are watching the assignee of the bug.