[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 22/47] vfio/common: return early if space isn't empty
From: |
Cédric Le Goater |
Subject: |
[PULL 22/47] vfio/common: return early if space isn't empty |
Date: |
Tue, 19 Dec 2023 19:56:18 +0100 |
From: Zhenzhong Duan <zhenzhong.duan@intel.com>
This is a trivial optimization. If there is active container in space,
vfio_reset_handler will never be unregistered. So revert the check of
space->containers and return early.
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Nicolin Chen <nicolinc@nvidia.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
hw/vfio/common.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index
572ae7c934070b9fdc66915f6831fb0fa1323941..934f4f5446e9fc7decd991148f3f7992bf653a4a
100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -1462,10 +1462,13 @@ VFIOAddressSpace *vfio_get_address_space(AddressSpace
*as)
void vfio_put_address_space(VFIOAddressSpace *space)
{
- if (QLIST_EMPTY(&space->containers)) {
- QLIST_REMOVE(space, list);
- g_free(space);
+ if (!QLIST_EMPTY(&space->containers)) {
+ return;
}
+
+ QLIST_REMOVE(space, list);
+ g_free(space);
+
if (QLIST_EMPTY(&vfio_address_spaces)) {
qemu_unregister_reset(vfio_reset_handler, NULL);
}
--
2.43.0
- [PULL 17/47] vfio/spapr: switch to spapr IOMMU BE add/del_section_window, (continued)
- [PULL 17/47] vfio/spapr: switch to spapr IOMMU BE add/del_section_window, Cédric Le Goater, 2023/12/19
- [PULL 18/47] vfio/spapr: Move prereg_listener into spapr container, Cédric Le Goater, 2023/12/19
- [PULL 15/47] vfio/container: Implement attach/detach_device, Cédric Le Goater, 2023/12/19
- [PULL 19/47] vfio/spapr: Move hostwin_list into spapr container, Cédric Le Goater, 2023/12/19
- [PULL 21/47] util/char_dev: Add open_cdev(), Cédric Le Goater, 2023/12/19
- [PULL 20/47] backends/iommufd: Introduce the iommufd object, Cédric Le Goater, 2023/12/19
- [PULL 22/47] vfio/common: return early if space isn't empty,
Cédric Le Goater <=
- [PULL 24/47] vfio/iommufd: Relax assert check for iommufd backend, Cédric Le Goater, 2023/12/19
- [PULL 23/47] vfio/iommufd: Implement the iommufd backend, Cédric Le Goater, 2023/12/19
- [PULL 26/47] vfio/pci: Extract out a helper vfio_pci_get_pci_hot_reset_info, Cédric Le Goater, 2023/12/19
- [PULL 25/47] vfio/iommufd: Add support for iova_ranges and pgsizes, Cédric Le Goater, 2023/12/19
- [PULL 31/47] vfio/platform: Allow the selection of a given iommu backend, Cédric Le Goater, 2023/12/19
- [PULL 28/47] vfio/iommufd: Enable pci hot reset through iommufd cdev interface, Cédric Le Goater, 2023/12/19
- [PULL 30/47] vfio/pci: Make vfio cdev pre-openable by passing a file handle, Cédric Le Goater, 2023/12/19
- [PULL 33/47] vfio/ap: Allow the selection of a given iommu backend, Cédric Le Goater, 2023/12/19
- [PULL 37/47] vfio: Make VFIOContainerBase poiner parameter const in VFIOIOMMUOps callbacks, Cédric Le Goater, 2023/12/19
- [PULL 36/47] vfio/ccw: Make vfio cdev pre-openable by passing a file handle, Cédric Le Goater, 2023/12/19