On 11/14/23 11:09, Zhenzhong Duan wrote: > 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.d...@intel.com> Reviewed-by: Eric Auger <eric.au...@redhat.com> Thanks Eric > --- > 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 572ae7c934..934f4f5446 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); > }
- [PATCH v6 04/21] vfio/iommufd: Implement the iommufd bac... Zhenzhong Duan
- Re: [PATCH v6 04/21] vfio/iommufd: Implement the io... Cédric Le Goater
- [PATCH v6 14/21] vfio/ap: Allow the selection of a given... Zhenzhong Duan
- Re: [PATCH v6 14/21] vfio/ap: Allow the selection o... Cédric Le Goater
- [PATCH v6 06/21] vfio/iommufd: Add support for iova_rang... Zhenzhong Duan
- Re: [PATCH v6 06/21] vfio/iommufd: Add support for ... Cédric Le Goater
- RE: [PATCH v6 06/21] vfio/iommufd: Add support ... Duan, Zhenzhong
- Re: [PATCH v6 06/21] vfio/iommufd: Add support ... Eric Auger
- [PATCH v6 03/21] vfio/common: return early if space isn'... Zhenzhong Duan
- Re: [PATCH v6 03/21] vfio/common: return early if s... Cédric Le Goater
- Re: [PATCH v6 03/21] vfio/common: return early if s... Eric Auger
- [PATCH v6 05/21] vfio/iommufd: Relax assert check for io... Zhenzhong Duan
- [PATCH v6 16/21] vfio/ccw: Allow the selection of a give... Zhenzhong Duan
- Re: [PATCH v6 16/21] vfio/ccw: Allow the selection ... Cédric Le Goater
- Re: [PATCH v6 16/21] vfio/ccw: Allow the selection ... Eric Farman
- [PATCH v6 19/21] hw/arm: Activate IOMMUFD for virt machi... Zhenzhong Duan
- [PATCH v6 02/21] util/char_dev: Add open_cdev() Zhenzhong Duan
- Re: [PATCH v6 02/21] util/char_dev: Add open_cdev() Cédric Le Goater
- Re: [PATCH v6 02/21] util/char_dev: Add open_cdev() Eric Auger