On Fri, Nov 07, 2025 at 12:49:36PM -0400, Jason Gunthorpe wrote: > When connected to VFIO, the only DMABUF exporter that is accepted, the > move_notify callback will be made when VFIO wants to remove access to the > MMIO. This is being called revoke. > > Wire up revoke to go through all the iommu_domain's that have mapped the > DMABUF and unmap them. > > The locking here is unpleasant, since the existing locking scheme was > designed to come from the iopt through the area to the pages we cannot use > pages as starting point for the locking. There is no way to obtain the > domains_rwsem before obtaining the pages mutex to reliably use the > existing domains_itree. > > Solve this problem by adding a new tracking structure just for DMABUF > revoke. Record a linked list of areas and domains inside the pages > mutex. Clean the entries on the list during revoke. The map/unmaps are now > all done under a pages mutex while updating the tracking linked list so > nothing can get out of sync. Only one lock is required for revoke > processing. > > Signed-off-by: Jason Gunthorpe <[email protected]> Reviewed-by: Nicolin Chen <[email protected]>
- [PATCH 0/9] Initial DMABUF support for iommufd Jason Gunthorpe
- [PATCH 1/9] vfio/pci: Add vfio_pci_dma_buf_iommufd_ma... Jason Gunthorpe
- [PATCH 3/9] iommufd: Do not map/unmap revoked DMABUFs Jason Gunthorpe
- Re: [PATCH 3/9] iommufd: Do not map/unmap revoked... Nicolin Chen
- RE: [PATCH 3/9] iommufd: Do not map/unmap revoked... Tian, Kevin
- [PATCH 7/9] iommufd: Have iopt_map_file_pages convert... Jason Gunthorpe
- Re: [PATCH 7/9] iommufd: Have iopt_map_file_pages... Nicolin Chen
- RE: [PATCH 7/9] iommufd: Have iopt_map_file_pages... Tian, Kevin
- [PATCH 4/9] iommufd: Allow a DMABUF to be revoked Jason Gunthorpe
- Re: [PATCH 4/9] iommufd: Allow a DMABUF to be rev... Nicolin Chen
- RE: [PATCH 4/9] iommufd: Allow a DMABUF to be rev... Tian, Kevin
- [PATCH 5/9] iommufd: Allow MMIO pages in a batch Jason Gunthorpe
- Re: [PATCH 5/9] iommufd: Allow MMIO pages in a ba... Nicolin Chen
- RE: [PATCH 5/9] iommufd: Allow MMIO pages in a ba... Tian, Kevin
- Re: [PATCH 5/9] iommufd: Allow MMIO pages in ... Jason Gunthorpe
- [PATCH 9/9] iommufd/selftest: Add some tests for the ... Jason Gunthorpe
- Re: [PATCH 9/9] iommufd/selftest: Add some tests ... Nicolin Chen
- Re: [PATCH 9/9] iommufd/selftest: Add some te... Jason Gunthorpe
- RE: [PATCH 9/9] iommufd/selftest: Add som... Tian, Kevin
- [PATCH 8/9] iommufd: Accept a DMABUF through IOMMU_IO... Jason Gunthorpe
