[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [qemu-upstream-unstable] vfio-pci: Release all MSI-X vectors when disabled



commit d90ff19d0a664400232ae062163790937068a0f8
Author:     Alex Williamson <alex.williamson@xxxxxxxxxx>
AuthorDate: Fri Dec 6 11:16:40 2013 -0700
Commit:     Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
CommitDate: Mon Dec 9 11:40:30 2013 -0600

    vfio-pci: Release all MSI-X vectors when disabled
    
    We were relying on msix_unset_vector_notifiers() to release all the
    vectors when we disable MSI-X, but this only happens when MSI-X is
    still enabled on the device.  Perform further cleanup by releasing
    any remaining vectors listed as in-use after this call.  This caused
    a leak of IRQ routes on hotplug depending on how the guest OS prepared
    the device for removal.
    
    Signed-off-by: Alex Williamson <alex.williamson@xxxxxxxxxx>
    Cc: qemu-stable@xxxxxxxxxx
    (cherry picked from commit 3e40ba0faf0822fa78336fe6cd9d677ea9b14f1b)
    
    Signed-off-by: Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
---
 hw/misc/vfio.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c
index d9e78e1..2bb2d09 100644
--- a/hw/misc/vfio.c
+++ b/hw/misc/vfio.c
@@ -873,8 +873,20 @@ static void vfio_disable_msi_common(VFIODevice *vdev)
 
 static void vfio_disable_msix(VFIODevice *vdev)
 {
+    int i;
+
     msix_unset_vector_notifiers(&vdev->pdev);
 
+    /*
+     * MSI-X will only release vectors if MSI-X is still enabled on the
+     * device, check through the rest and release it ourselves if necessary.
+     */
+    for (i = 0; i < vdev->nr_vectors; i++) {
+        if (vdev->msi_vectors[i].use) {
+            vfio_msix_vector_release(&vdev->pdev, i);
+        }
+    }
+
     if (vdev->nr_vectors) {
         vfio_disable_irqindex(vdev, VFIO_PCI_MSIX_IRQ_INDEX);
     }
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.