From: Jason Gunthorpe jgg@nvidia.com Sent: Wednesday, October 26, 2022 2:12 AM
+int iommufd_vfio_compat_ioas_id(struct iommufd_ctx *ictx, u32 *out_ioas_id) +{
- struct iommufd_ioas *ioas = NULL;
- struct iommufd_ioas *out_ioas;
- ioas = iommufd_ioas_alloc(ictx);
- if (IS_ERR(ioas))
return PTR_ERR(ioas);
I tried to find out where the auto-created compat_ioas is destroyed.
Is my understanding correct that nobody holds a long-term users count on it then we expect it to be destroyed in iommufd release?
If yes, probably worth adding a comment to explain this behavior.
- case IOMMU_VFIO_IOAS_SET:
ioas = iommufd_get_ioas(ucmd, cmd->ioas_id);if (IS_ERR(ioas))return PTR_ERR(ioas);xa_lock(&ucmd->ictx->objects);ucmd->ictx->vfio_ioas = ioas;xa_unlock(&ucmd->ictx->objects);iommufd_put_object(&ioas->obj);return 0;
disallow changing vfio_ioas when it's already in-use e.g. has a list of hwpt attached?