[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 8/9] Revert "vfio: Avoid disabling and enabling vectors repeat
From: |
Longpeng(Mike) |
Subject: |
[PATCH v2 8/9] Revert "vfio: Avoid disabling and enabling vectors repeatedly in VFIO migration" |
Date: |
Thu, 9 Sep 2021 14:06:12 +0800 |
Commit ecebe53fe993 ("vfio: Avoid disabling and enabling vectors
repeatedly in VFIO migration") avoid inefficiently disabling and
enabling vectors repeatedly and let the unmasked vectors to be
enabled one by one.
But we want to batch multiple routes and defer the commit, and only
commit once out side the loop of setting vector notifiers, so we
cannot to enable the vectors one by one in the loop now.
Revert that commit and we will take another way in the next patch,
it can not only avoid disabling/enabling vectors repeatedly, but
also satisfy our requirement of defer to commit.
Signed-off-by: Longpeng(Mike) <longpeng2@huawei.com>
---
hw/vfio/pci.c | 20 +++-----------------
1 file changed, 3 insertions(+), 17 deletions(-)
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index dda60a5..4aedb5a 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -608,9 +608,6 @@ static void vfio_commit_kvm_msi_virq(VFIOPCIDevice *vdev)
static void vfio_msix_enable(VFIOPCIDevice *vdev)
{
- PCIDevice *pdev = &vdev->pdev;
- unsigned int nr, max_vec = 0;
-
vfio_disable_interrupts(vdev);
vdev->msi_vectors = g_new0(VFIOMSIVector, vdev->msix->entries);
@@ -629,22 +626,11 @@ static void vfio_msix_enable(VFIOPCIDevice *vdev)
* triggering to userspace, then immediately release the vector, leaving
* the physical device with no vectors enabled, but MSI-X enabled, just
* like the guest view.
- * If there are already unmasked vectors (in migration resume phase and
- * some guest startups) which will be enabled soon, we can allocate all
- * of them here to avoid inefficiently disabling and enabling vectors
- * repeatedly later.
*/
- if (!pdev->msix_function_masked) {
- for (nr = 0; nr < msix_nr_vectors_allocated(pdev); nr++) {
- if (!msix_is_masked(pdev, nr)) {
- max_vec = nr;
- }
- }
- }
- vfio_msix_vector_do_use(pdev, max_vec, NULL, NULL);
- vfio_msix_vector_release(pdev, max_vec);
+ vfio_msix_vector_do_use(&vdev->pdev, 0, NULL, NULL);
+ vfio_msix_vector_release(&vdev->pdev, 0);
- if (msix_set_vector_notifiers(pdev, vfio_msix_vector_use,
+ if (msix_set_vector_notifiers(&vdev->pdev, vfio_msix_vector_use,
vfio_msix_vector_release, NULL)) {
error_report("vfio: msix_set_vector_notifiers failed");
}
--
1.8.3.1
- [PATCH v2 0/9] optimize the downtime for vfio migration, Longpeng(Mike), 2021/09/09
- [PATCH v2 5/9] msix: reset poll_notifier to NULL if fail to set notifiers, Longpeng(Mike), 2021/09/09
- [PATCH v2 6/9] kvm: irqchip: extract kvm_irqchip_add_deferred_msi_route, Longpeng(Mike), 2021/09/09
- [PATCH v2 8/9] Revert "vfio: Avoid disabling and enabling vectors repeatedly in VFIO migration",
Longpeng(Mike) <=
- [PATCH v2 1/9] vfio: simplify the conditional statements in vfio_msi_enable, Longpeng(Mike), 2021/09/09
- [PATCH v2 2/9] vfio: move re-enabling INTX out of the common helper, Longpeng(Mike), 2021/09/09
- [PATCH v2 4/9] msix: simplify the conditional in msix_set/unset_vector_notifiers, Longpeng(Mike), 2021/09/09
- [PATCH v2 3/9] vfio: simplify the failure path in vfio_msi_enable, Longpeng(Mike), 2021/09/09
- [PATCH v2 9/9] vfio: defer to commit kvm irq routing when enable msi/msix, Longpeng(Mike), 2021/09/09
- [PATCH v2 7/9] vfio: add infrastructure to commit the deferred kvm routing, Longpeng(Mike), 2021/09/09
- Re: [PATCH v2 0/9] optimize the downtime for vfio migration, Longpeng (Mike, Cloud Infrastructure Service Product Dept.), 2021/09/20