[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220715155928.26362-1-dmy@semihalf.com>
Date: Fri, 15 Jul 2022 17:59:25 +0200
From: Dmytro Maluka <dmy@...ihalf.com>
To: Sean Christopherson <seanjc@...gle.com>,
Paolo Bonzini <pbonzini@...hat.com>, kvm@...r.kernel.org
Cc: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>, linux-kernel@...r.kernel.org,
Eric Auger <eric.auger@...hat.com>,
Alex Williamson <alex.williamson@...hat.com>,
Rong L Liu <rong.l.liu@...el.com>,
Zhenyu Wang <zhenyuw@...ux.intel.com>,
Tomasz Nowicki <tn@...ihalf.com>,
Grzegorz Jaszczyk <jaz@...ihalf.com>,
Dmitry Torokhov <dtor@...gle.com>,
Dmytro Maluka <dmy@...ihalf.com>
Subject: [PATCH 0/3] KVM: Fix oneshot interrupts forwarding
The existing KVM mechanism for forwarding of level-triggered interrupts
using resample eventfd doesn't work quite correctly in the case of
interrupts that are handled in a Linux guest as oneshot interrupts
(IRQF_ONESHOT). Such an interrupt is acked to the device in its
threaded irq handler, i.e. later than it is acked to the interrupt
controller (EOI at the end of hardirq), not earlier. The existing KVM
code doesn't take that into account, which results in erroneous extra
interrupts in the guest caused by premature re-assert of an
unacknowledged IRQ by the host.
This patch series fixes this issue (for now on x86 only) by checking if
the interrupt is unmasked when we receive irq ack (EOI) and, in case if
it's masked, postponing resamplefd notify until the guest unmasks it.
Patches 1 and 2 implement the prerequisites needed for KVM irqfd to
know the interrupt mask state. Patch 3 implements the actual fix:
postponing resamplefd notify in KVM irqfd until the irq is unmasked.
Please see individual patches for more details.
Dmytro Maluka (3):
KVM: x86: Move kvm_(un)register_irq_mask_notifier() to generic KVM
KVM: x86: Add kvm_irq_is_masked()
KVM: irqfd: Postpone resamplefd notify for oneshot interrupts
arch/x86/include/asm/kvm_host.h | 11 +-----
arch/x86/kvm/i8259.c | 11 ++++++
arch/x86/kvm/ioapic.c | 11 ++++++
arch/x86/kvm/ioapic.h | 1 +
arch/x86/kvm/irq_comm.c | 34 +++++++++---------
include/linux/kvm_host.h | 13 +++++++
include/linux/kvm_irqfd.h | 14 ++++++++
virt/kvm/eventfd.c | 63 +++++++++++++++++++++++++++++++++
virt/kvm/irqchip.c | 34 ++++++++++++++++++
9 files changed, 164 insertions(+), 28 deletions(-)
--
2.37.0.170.g444d1eabd0-goog
Powered by blists - more mailing lists