On Thu, Mar 23, 2023 at 07:21:42AM +0000, Tian, Kevin wrote: > > From: Jason Gunthorpe <jgg@xxxxxxxxxx> > > Sent: Wednesday, March 22, 2023 3:15 AM > > > > /* > > - * FIXME: Hack around missing a device-centric iommu api, only > > attach to > > - * the group once for the first device that is in the group. > > + * Only attach to the group once for the first device that is in the > > + * group. All the other devices will follow this attachment. The user > > + * should attach every device individually to as the per-device > > reserved > > "individually to the hwpt" Done > I thought about whether holding igroup->lock is necessary here. > > The caller should avoid racing attach/detach/replace on the same device. I think even if the caller races we should be fine The point of the lock scope was the capture these lines: rc = iopt_table_add_domain(&hwpt->ioas->iopt, hwpt->domain); if (rc) goto out_detach; list_add_tail(&hwpt->hwpt_item, &hwpt->ioas->hwpt_list); But based on the current arrangement none of them rely on the igroup mutex so it does seem we can narrow it Thanks, Jason