Skip to contentSkip to conversation

qemu-kvm: fix no gsi routing warning

PATCH In review Michael S. Tsirkin 2 participants 4 messages Sep 21, 2009 – Sep 23, 2009 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qemu-kvm: fix no gsi routing warning

When running on host kernel which does not let the guest manupulate the gsi routing, and user requested MSI-X to be enabled, we get the following warnings:
kvm_msix_add: kvm_get_irq_route_gsi failed: No space left on device
kvm_msix_update: kvm_update_routing_entry failed: Invalid argument

What really happens is that we report a failure to allocate a vector to the guest, it will retry and finally disable MSI.

Make this clearer by checking for gsi capability and warning about the error in a readable form.

---
 hw/msix.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
hw/msix.c +7 -0
index fcd425f..5695582 100644
@@ -129,6 +129,13 @@ static int kvm_msix_add(PCIDevice *dev, unsigned vector)
     struct kvm_irq_routing_entry *entry = dev->msix_irq_entries + vector;
     int r;
 
+    if (!kvm_has_gsi_routing(kvm_context)) {
+        fprintf(stderr, "Warning: no MSI-X support found. "
+                "At least kernel 2.6.30 is required for MSI-X support.\n"
+               );
+        return -EOPNOTSUPP;
+    }
+
     r = kvm_get_irq_route_gsi(kvm_context);
     if (r < 0) {
         fprintf(stderr, "%s: kvm_get_irq_route_gsi failed: %s\n", __func__, strerror(-r));
Signature · 1 line
1.6.2.5
#1 lore raw
Quoted 6 lines · Michael S. Tsirkin

When running on host kernel which does not let the guest manupulate the gsi routing, and user requested MSI-X to be enabled, we get the following warnings:
kvm_msix_add: kvm_get_irq_route_gsi failed: No space left on device
kvm_msix_update: kvm_update_routing_entry failed: Invalid argument

Quoted 7 lines

What really happens is that we report a failure to allocate a vector to the guest, it will retry and finally disable MSI.

Make this clearer by checking for gsi capability and warning about the error in a readable form.

Can we disable msix (or, abort qemu at startup and request that the user disable msix) if the kernel doesn't provide required features? It's better than a runtime error.

Signature · 1 line
error compiling committee.c: too many arguments to function
#2 lore raw
Quoted 10 lines · Avi Kivity
Quoted 9 lines · Michael S. Tsirkin

When running on host kernel which does not let the guest manupulate the gsi routing, and user requested MSI-X to be enabled, we get the following warnings:
kvm_msix_add: kvm_get_irq_route_gsi failed: No space left on device
kvm_msix_update: kvm_update_routing_entry failed: Invalid argument

What really happens is that we report a failure to allocate a vector to the guest, it will retry and finally disable MSI.

Quoted 6 lines
Quoted 4 lines

Make this clearer by checking for gsi capability and warning about the error in a readable form.

Can we disable msix

What we do effectively disables msix.

Quoted 4 lines

(or, abort qemu at startup and request that the user disable msix) if the kernel doesn't provide required features?
It's
better than a runtime error.

Note it's a warning, not an error.

We have a similar failure mode when we run out of gsi entries, and that can not be checked upfront. I prefer having it fail in the same way, so that this failure path in guest drivers is excercised and tested.

Quoted 2 lines
Signature · 1 line
error compiling committee.c: too many arguments to function
#3 lore raw
Quoted 28 lines · Michael S. Tsirkin
Quoted 11 lines · Avi Kivity
Quoted 9 lines · Michael S. Tsirkin

When running on host kernel which does not let the guest manupulate the gsi routing, and user requested MSI-X to be enabled, we get the following warnings:
kvm_msix_add: kvm_get_irq_route_gsi failed: No space left on device
kvm_msix_update: kvm_update_routing_entry failed: Invalid argument

What really happens is that we report a failure to allocate a vector to the guest, it will retry and finally disable MSI.

Quoted 7 lines
Quoted 5 lines

Make this clearer by checking for gsi capability and warning about the error in a readable form.

Can we disable msix

What we do effectively disables msix.

Quoted 5 lines

(or, abort qemu at startup and request that the user disable msix) if the kernel doesn't provide required features?
It's
better than a runtime error.

Quoted 6 lines

Note it's a warning, not an error.

We have a similar failure mode when we run out of gsi entries, and that can not be checked upfront. I prefer having it fail in the same way, so that this failure path in guest drivers is excercised and tested.

I see, applied the patch, thanks.

Signature · 1 line
error compiling committee.c: too many arguments to function