* [Qemu-devel] [PATCH] vfio-pci: Release all MSI-X vectors when disabled
@ 2013-11-21 23:19 Alex Williamson
2013-11-22 20:02 ` Bandan Das
0 siblings, 1 reply; 2+ messages in thread
From: Alex Williamson @ 2013-11-21 23:19 UTC (permalink / raw)
To: alex.williamson, qemu-devel; +Cc: bsd, qemu-stable
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@redhat.com>
Cc: qemu-stable@nongnu.org
---
hw/misc/vfio.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c
index f7f8a19..355b018 100644
--- a/hw/misc/vfio.c
+++ b/hw/misc/vfio.c
@@ -878,8 +878,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);
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] vfio-pci: Release all MSI-X vectors when disabled
2013-11-21 23:19 [Qemu-devel] [PATCH] vfio-pci: Release all MSI-X vectors when disabled Alex Williamson
@ 2013-11-22 20:02 ` Bandan Das
0 siblings, 0 replies; 2+ messages in thread
From: Bandan Das @ 2013-11-22 20:02 UTC (permalink / raw)
To: Alex Williamson; +Cc: qemu-devel, qemu-stable
Alex Williamson <alex.williamson@redhat.com> writes:
> 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@redhat.com>
> Cc: qemu-stable@nongnu.org
> ---
> hw/misc/vfio.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c
> index f7f8a19..355b018 100644
> --- a/hw/misc/vfio.c
> +++ b/hw/misc/vfio.c
> @@ -878,8 +878,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);
> }
Reviewed-by: Bandan Das <bsd@redhat.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-11-22 20:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-21 23:19 [Qemu-devel] [PATCH] vfio-pci: Release all MSI-X vectors when disabled Alex Williamson
2013-11-22 20:02 ` Bandan Das
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).