From: Jason Gunthorpe jgg@nvidia.com Sent: Thursday, February 23, 2023 5:03 AM @@ -753,6 +744,10 @@ iommufd_device_selftest_attach(struct iommufd_ctx *ictx, if (rc) goto out_hwpt;
- mutex_lock(&ioas->mutex);
- list_add_tail(&hwpt->hwpt_item, &hwpt->ioas->hwpt_list);
- mutex_unlock(&ioas->mutex);
- refcount_inc(&hwpt->obj.users); iommufd_object_finalize(ictx, &hwpt->obj); return hwpt;
@@ -765,7 +760,6 @@ iommufd_device_selftest_attach(struct iommufd_ctx *ictx, void iommufd_device_selftest_detach(struct iommufd_ctx *ictx, struct iommufd_hw_pagetable *hwpt) {
- iopt_table_remove_domain(&hwpt->ioas->iopt, hwpt->domain); refcount_dec(&hwpt->obj.users);
} #endif
It will read clearer if first having a patch to add list_add_tail() to selftest attach and list_del() in selftest detach and then having this patch to move list_del()+iopt_table_remove_domain() to HWPT destruction.