kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* QEMU's Hyper-V HV_X64_MSR_EOM is broken with split IRQCHIP
@ 2025-03-03 23:57 Sean Christopherson
  2025-03-04 12:59 ` Vitaly Kuznetsov
  0 siblings, 1 reply; 8+ messages in thread
From: Sean Christopherson @ 2025-03-03 23:57 UTC (permalink / raw)
  To: Vitaly Kuznetsov; +Cc: kvm, linux-kernel, Paolo Bonzini, Peter Xu

FYI, QEMU's Hyper-V emulation of HV_X64_MSR_EOM has been broken since QEMU commit
c82d9d43ed ("KVM: Kick resamplefd for split kernel irqchip"), as nothing in KVM
will forward the EOM notification to userspace.  I have no idea if anything in
QEMU besides hyperv_testdev.c cares.

The bug is reproducible by running the hyperv_connections KVM-Unit-Test with a
split IRQCHIP.

Hacking QEMU and KVM (see KVM commit 654f1f13ea56 ("kvm: Check irqchip mode before
assign irqfd") as below gets the test to pass.  Assuming that's not a palatable
solution, the other options I can think of would be for QEMU to intercept
HV_X64_MSR_EOM when using a split IRQCHIP, or to modify KVM to do KVM_EXIT_HYPERV_SYNIC
on writes to HV_X64_MSR_EOM with a split IRQCHIP.

diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index c65b790433..820bc1692e 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -2261,10 +2261,9 @@ static int kvm_irqchip_assign_irqfd(KVMState *s, EventNotifier *event,
              * the INTx slow path).
              */
             kvm_resample_fd_insert(virq, resample);
-        } else {
-            irqfd.flags |= KVM_IRQFD_FLAG_RESAMPLE;
-            irqfd.resamplefd = rfd;
         }
+        irqfd.flags |= KVM_IRQFD_FLAG_RESAMPLE;
+        irqfd.resamplefd = rfd;
     } else if (!assign) {
         if (kvm_irqchip_is_split()) {
             kvm_resample_fd_remove(virq);


diff --git a/arch/x86/kvm/irq.c b/arch/x86/kvm/irq.c
index 63f66c51975a..0bf85f89eb27 100644
--- a/arch/x86/kvm/irq.c
+++ b/arch/x86/kvm/irq.c
@@ -166,9 +166,7 @@ void __kvm_migrate_timers(struct kvm_vcpu *vcpu)
 
 bool kvm_arch_irqfd_allowed(struct kvm *kvm, struct kvm_irqfd *args)
 {
-       bool resample = args->flags & KVM_IRQFD_FLAG_RESAMPLE;
-
-       return resample ? irqchip_kernel(kvm) : irqchip_in_kernel(kvm);
+       return irqchip_in_kernel(kvm);
 }
 
 bool kvm_arch_irqchip_in_kernel(struct kvm *kvm)


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-03-06 10:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-03 23:57 QEMU's Hyper-V HV_X64_MSR_EOM is broken with split IRQCHIP Sean Christopherson
2025-03-04 12:59 ` Vitaly Kuznetsov
2025-03-04 13:50   ` Maciej S. Szmigiero
2025-03-04 14:24   ` Sean Christopherson
2025-03-04 14:46     ` Vitaly Kuznetsov
2025-03-04 21:31       ` Maxim Levitsky
2025-03-05  9:31         ` Vitaly Kuznetsov
2025-03-06 10:00           ` Vitaly Kuznetsov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).