06.07.2021 19:28, Paolo Bonzini пишет:
On 29/06/21 00:27, Jim Mattson wrote:
static int kvm_vcpu_ready_for_interrupt_injection(struct kvm_vcpu
*vcpu)
{
return kvm_arch_interrupt_allowed(vcpu) &&
kvm_cpu_accept_dm_intr(vcpu);
}
It looks like Paolo may have broken this in commit 71cc849b7093
("KVM: x86: Fix split-irqchip vs interrupt injection window request").
The commit message seems focused only on
vcpu->arch.interrupt.injected. Perhaps he overlooked
vcpu->arch.exception.injected.
I was expecting the exception to be injected first and the interrupt
second.
But something like this should fix it:
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 21877ad2214e..dddff682c9c2 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4277,6 +4277,9 @@ static int kvm_vcpu_ioctl_set_lapic(struct
kvm_vcpu *vcpu,
static int kvm_cpu_accept_dm_intr(struct kvm_vcpu *vcpu)
{
+ if (kvm_event_needs_reinjection(vcpu))
+ return false;
+
/*
* We can accept userspace's request for interrupt injection
* as long as we have a place to store the interrupt number.
I'll figure out a selftest to better understand what's going on. In
the meanwhile
Stas can test it!
I confirm that this works, thanks.
Sadly the problematic patch was
CCed to -stable, and is now present
in all kernels, like ubuntu's 5.8.0-55-generic.
Since AFAICT it didn't contain the
important/security fix, I think it
shouldn't have been CCed to -stable.
Can we revert it from -stable?
That will mean a relatively quick
fix for most of current users.