RE: [RFC PATCH] iommufd: Destroy vdevice on device unbind
From: Tian, Kevin
Date: Mon Jun 16 2025 - 01:48:56 EST
> From: Aneesh Kumar K.V <aneesh.kumar@xxxxxxxxxx>
> Sent: Monday, June 16, 2025 12:46 PM
>
> What I described above explains how the kernel manages destruction of
> these objects.
>
> The vfio subsystem retains a reference to the iommufd file descriptor
> through:
>
> vfio_df_ioctl_bind_iommufd() → iommufd_ctx_from_fd()
>
> This reference prevents the associated vdevice from being destroyed when
> the iommufd file descriptor is closed, as long as the idevice remains
> bound. While vdevice objects can still be explicitly destroyed using
> iommufd_destroy(), with this patch, if the idevice is still bound,
> attempting to destroy the vdevice will return EBUSY.
this is counter-intuitive. My impression from previous discussion was
that the vdevice lifecycle is gated by the idevice (i.e. cannot live
longer) once they are connected, but not that the vdevice can only
be destroyed indirectly via unbind (cannot live shorter)...
If this is a TIO specific requirement it's better to articulate it early.