[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 04/11] Revert "vfio: Avoid disabling and enabling vectors repeated
From: |
Alex Williamson |
Subject: |
[PULL 04/11] Revert "vfio: Avoid disabling and enabling vectors repeatedly in VFIO migration" |
Date: |
Fri, 06 May 2022 14:47:23 -0600 |
User-agent: |
StGit/1.0-8-g6af9-dirty |
From: Longpeng(Mike) <longpeng2@huawei.com>
Commit ecebe53fe993 ("vfio: Avoid disabling and enabling vectors
repeatedly in VFIO migration") avoids inefficiently disabling and
enabling vectors repeatedly and lets the unmasked vectors be enabled
one by one.
But we want to batch multiple routes and defer the commit, and only
commit once outside the loop of setting vector notifiers, so we
cannot 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>
Link: https://lore.kernel.org/r/20220326060226.1892-5-longpeng2@huawei.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.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 50562629ea8f..8bc36f081afd 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -572,9 +572,6 @@ static void vfio_msix_vector_release(PCIDevice *pdev,
unsigned int nr)
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);
@@ -593,22 +590,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");
}
- [PULL 00/11] Series short description, Alex Williamson, 2022/05/06
- [PULL 01/11] vfio: simplify the conditional statements in vfio_msi_enable, Alex Williamson, 2022/05/06
- [PULL 02/11] vfio: move re-enabling INTX out of the common helper, Alex Williamson, 2022/05/06
- [PULL 03/11] vfio: simplify the failure path in vfio_msi_enable, Alex Williamson, 2022/05/06
- [PULL 04/11] Revert "vfio: Avoid disabling and enabling vectors repeatedly in VFIO migration",
Alex Williamson <=
- [PULL 05/11] vfio: defer to commit kvm irq routing when enable msi/msix, Alex Williamson, 2022/05/06
- [PULL 06/11] vfio/common: Fix a small boundary issue of a trace, Alex Williamson, 2022/05/06
- [PULL 07/11] sysemu: tpm: Add a stub function for TPM_IS_CRB, Alex Williamson, 2022/05/06
- [PULL 08/11] vfio/common: remove spurious tpm-crb-cmd misalignment warning, Alex Williamson, 2022/05/06
- [PULL 09/11] hw/vfio/pci: fix vfio_pci_hot_reset_result trace point, Alex Williamson, 2022/05/06
- [PULL 10/11] vfio/pci: Use vbasedev local variable in vfio_realize(), Alex Williamson, 2022/05/06
- [PULL 11/11] vfio/common: Rename VFIOGuestIOMMU::iommu into ::iommu_mr, Alex Williamson, 2022/05/06