> From: Jason Gunthorpe <[email protected]> > Sent: Saturday, November 8, 2025 12:50 AM > > 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: Kevin Tian <[email protected]>
