On Mon, Aug 11, 2025 at 03:59:10PM -0700, Nicolin Chen wrote: > Introduce a new iommu_get_domain_for_dev_locked() helper to be used by > those drivers in a context that is already under the protection of the > group->mutex, e.g. those attach_dev callback functions. And roll out the > new helper to all the existing IOMMU drivers. I still don't much care for this, I think it would be better to approach this problem by passing the old domain to the driver callback: > @@ -390,7 +390,7 @@ static int qcom_iommu_attach_dev(struct iommu_domain *domain, struct device *dev > static int qcom_iommu_identity_attach(struct iommu_domain *identity_domain, > struct device *dev) > { > - struct iommu_domain *domain = iommu_get_domain_for_dev(dev); > + struct iommu_domain *domain = iommu_get_domain_for_dev_locked(dev); Because this is a very common pattern in drivers. Once that is done we can see what calls to iommu_get_domain_for_dev() are even left, arguably we should be trying to eliminate this badly locked thing... Jason