> From: Baolu Lu <baolu.lu@xxxxxxxxxxxxxxx> > Sent: Friday, August 15, 2025 1:10 PM > > On 8/12/25 06:59, Nicolin Chen wrote: > > > > + /* > > + * This is called on the dma mapping fast path so avoid locking. This is > > + * racy, but we have an expectation that the driver will setup its > DMAs > > Why not making it like this, > > int iommu_deferred_attach(struct device *dev, struct iommu_domain > *domain) > { > /* Caller must be a probed driver on dev */ > if (!dev->iommu_group) > return 0; > > guard(mutex)(&dev->iommu_group->mutex); > if (!dev->iommu->attach_deferred) > return 0; > > return __iommu_attach_device(domain, dev); > } > As the comment said it's the fast path so avoid locking. your way implies that every map call needs to acquire the group mutex.