Skip to contentSkip to conversation

s390x/pci: set kvm_msi_via_irqfd_allowed

PATCH Superseded Matthew Rosato 3 participants 5 messages Oct 1, 2025 – Oct 2, 2025

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390x/pci: set kvm_msi_via_irqfd_allowed

Allow irqfd to be used for virtio-pci on s390x if the kernel supports it.

---
 hw/s390x/s390-pci-bus.c | 1 +
 1 file changed, 1 insertion(+)
hw/s390x/s390-pci-bus.c +1 -0
index e8e41c8a9a..88852acf45 100644
@@ -900,6 +900,7 @@ static void s390_pcihost_realize(DeviceState *dev, Error **errp)
     s390_pci_init_default_group();
     css_register_io_adapters(CSS_IO_ADAPTER_PCI, true, false,
                              S390_ADAPTER_SUPPRESSIBLE, errp);
+    kvm_msi_via_irqfd_allowed = kvm_irqfds_enabled();
 }
 
 static void s390_pcihost_unrealize(DeviceState *dev)
Signature · 1 line
2.51.0
#1 lore raw
Quoted 5 lines · Matthew Rosato

Allow irqfd to be used for virtio-pci on s390x if the kernel supports it.

---

FWIW we've been using this change in-house for a while now under test different scenarios - AFAICT failure to set this was just a past oversight since virtio-pci is not the default/recommendation for s390x.

Quoted 15 lines
 hw/s390x/s390-pci-bus.c | 1 +
 1 file changed, 1 insertion(+)
hw/s390x/s390-pci-bus.c +1 -0
index e8e41c8a9a..88852acf45 100644
@@ -900,6 +900,7 @@ static void s390_pcihost_realize(DeviceState *dev, Error **errp)
     s390_pci_init_default_group();
     css_register_io_adapters(CSS_IO_ADAPTER_PCI, true, false,
                              S390_ADAPTER_SUPPRESSIBLE, errp);
+    kvm_msi_via_irqfd_allowed = kvm_irqfds_enabled();
 }
 
 static void s390_pcihost_unrealize(DeviceState *dev)
#2 lore raw
In reply to Matthew Rosato
Quoted 13 lines · Matthew Rosato

Allow irqfd to be used for virtio-pci on s390x if the kernel supports it.

---
  hw/s390x/s390-pci-bus.c | 1 +
  1 file changed, 1 insertion(+)
hw/s390x/s390-pci-bus.c +0 -0
index e8e41c8a9a..88852acf45 100644

hw/s390x/s390-pci-bus.c static void s390_pcihost_realize(DeviceState *dev, Error **errp) · line 903

Quoted 4 lines
hw/s390x/s390-pci-bus.c +1 -0
@@ -900,6 +900,7 @@ static void s390_pcihost_realize(DeviceState *dev, Error **errp)
      s390_pci_init_default_group();
      css_register_io_adapters(CSS_IO_ADAPTER_PCI, true, false,
                               S390_ADAPTER_SUPPRESSIBLE, errp);
+    kvm_msi_via_irqfd_allowed = kvm_irqfds_enabled();

Just wondering, what's the net result of this patch?

I assume better performance. Might be worth adding that "why" to the patch description.

Signature · 3 lines
Cheers

David / dhildenb
#3 lore raw
Quoted 9 lines · David Hildenbrand
Quoted 8 lines · Matthew Rosato

Allow irqfd to be used for virtio-pci on s390x if the kernel supports it.

---
  hw/s390x/s390-pci-bus.c | 1 +

  1 file changed, 1 insertion(+)
Quoted 12 lines

hw/s390x/s390-pci-bus.c static void s390_pcihost_realize(DeviceState *dev, Error **errp) · line 903

Quoted 9 lines
hw/s390x/s390-pci-bus.c +1 -0
index e8e41c8a9a..88852acf45 100644
@@ -900,6 +900,7 @@ static void s390_pcihost_realize(DeviceState *dev, Error **errp)
       s390_pci_init_default_group();
       css_register_io_adapters(CSS_IO_ADAPTER_PCI, true, false,
                                S390_ADAPTER_SUPPRESSIBLE, errp);
+    kvm_msi_via_irqfd_allowed = kvm_irqfds_enabled();

Just wondering, what's the net result of this patch?

It allows the virtio-pci core code on s390x to ever decide using irqfd is OK (e.g. without this change we would always reach virtio_queue_set_guest_notifier_fd_handler(..., with_irqfd=false) because kvm_msi_via_irqfd_enabled() was guaranteed to be false.

Quoted 2 lines

I assume better performance. Might be worth adding that "why" to the patch description.

And yes, in a nutshell it means better performance.

How about something like...

Allow irqfd to be used for virtio-pci on s390x if the kernel supports it. This improves s390x virtio-pci performance when using kvm acceleration by allowing kvm to deliver interrupts instead of QEMU.

Reviewed-by on v1 1/1
#4 lore raw
In reply to Matthew Rosato
Quoted 7 lines · Matthew Rosato

Allow irqfd to be used for virtio-pci on s390x if the kernel supports it.

---
 hw/s390x/s390-pci-bus.c | 1 +
 1 file changed, 1 insertion(+)

As Matt alluded to in another reply, this is probably just historical oversight.

Quoted 13 lines
hw/s390x/s390-pci-bus.c +1 -0
index e8e41c8a9a..88852acf45 100644
@@ -900,6 +900,7 @@ static void s390_pcihost_realize(DeviceState *dev, Error **errp)
     s390_pci_init_default_group();
     css_register_io_adapters(CSS_IO_ADAPTER_PCI, true, false,
                              S390_ADAPTER_SUPPRESSIBLE, errp);
+    kvm_msi_via_irqfd_allowed = kvm_irqfds_enabled();
 }
 
 static void s390_pcihost_unrealize(DeviceState *dev)