[RFC PATCH] Fix split-irqchip vs interrupt injection window request.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2020-11-12 at 13:03 +0000, David Woodhouse wrote:
> I'm using nested VMX for testing, while I add split-irqchip support to
> my VMM. I see the vCPU lock up when attempting to deliver an interrupt.

Turns out I don't need nesting or my own VMM to reproduce this; all I
need to do is boot a guest in qemu with split-irqchip and 'noapic' on
the guest command line. It locks up before getting to a login prompt,
every time.

qemu-system-x86_64 -serial mon:stdio -machine q35,accel=kvm,kernel-irqchip=split -m 2G -display none -drive file=foo.qcow2,if=virtio

Commit 782d422bc ("KVM: x86: split kvm_vcpu_ready_for_interrupt_injection
out of dm_request_for_irq_injection") made dm_request_for_irq_injection()
return true even when kvm_cpu_has_interrupt() is true.

So we enable the vmexit on interrupt window because userspace asked for
it, but then kvm_vcpu_ready_for_interrupt_injection() returns false,
causing us *not* to exit all the way to userspace but just to loop in
vcpu_run() instead.

But we *didn't* have an injectable interrupt from the kernel, so we
just go straight back into the guest, vmexit again, loop again, ad
infinitum.

This appears to fix it:

--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4028,7 +4028,7 @@ static int kvm_cpu_accept_dm_intr(struct kvm_vcpu *vcpu)
 static int kvm_vcpu_ready_for_interrupt_injection(struct kvm_vcpu *vcpu)
 {
        return kvm_arch_interrupt_allowed(vcpu) &&
-               !kvm_cpu_has_interrupt(vcpu) &&
+               !kvm_cpu_has_injectable_intr(vcpu) &&
                !kvm_event_needs_reinjection(vcpu) &&
                kvm_cpu_accept_dm_intr(vcpu);
 }

Attachment: smime.p7s
Description: S/MIME cryptographic signature


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux