[RFC PATCH 17/30] iommufd/device: Add TSM Bind/Unbind for TIO support

Jason Gunthorpe jgg at nvidia.com
Tue Jun 3 12:21:49 UTC 2025


On Tue, Jun 03, 2025 at 02:20:51PM +0800, Xu Yilun wrote:
> > Wouldn’t it be simpler to skip the reference count increment altogether
> > and just call tsm_unbind in the virtual device’s destroy callback?
> > (iommufd_vdevice_destroy())
> 
> The vdevice refcount is the main concern, there is also an IOMMU_DESTROY
> ioctl. User could just free the vdevice instance if no refcount, while VFIO
> is still in bound state. That seems not the correct free order.

Freeing the vdevice should automatically unbind it..

Jason


More information about the dri-devel mailing list