On Sat, Oct 19, 2024 at 06:42:30PM -0700, Nicolin Chen wrote:
But be mindful of this abort, it doesn't want to be inside the lock if it also gets the lock.. fail_nth should be updated to cover these new ioctls to look for tricky things like that
I added an abort() beside destroy():
+void iommufd_vdevice_abort(struct iommufd_object *obj) +{
struct iommufd_vdevice *old, *vdev =
container_of(obj, struct iommufd_vdevice, obj);
struct iommufd_viommu *viommu = vdev->viommu;
struct iommufd_device *idev = vdev->idev;
lockdep_assert_not_held(&idev->igroup->lock);
???
if (viommu->ops && viommu->ops->vdevice_free)
viommu->ops->vdevice_free(vdev);
old = xa_cmpxchg(&viommu->vdevs, vdev->id, vdev, NULL, GFP_KERNEL);
if (old)
WARN_ON(old != vdev);
refcount_dec(&viommu->obj.users);
refcount_dec(&idev->obj.users);
idev->vdev = NULL;
+}
+void iommufd_vdevice_destroy(struct iommufd_object *obj) +{
struct iommufd_vdevice *vdev =
container_of(obj, struct iommufd_vdevice, obj);
mutex_lock(&vdev->idev->igroup->lock);
iommufd_vdevice_abort(obj);
When we get it here??
Jason