Re: [PATCH v6 02/11] driver core: Add dma_cleanup callback in bus_type

From: Lu Baolu
Date: Tue Feb 22 2022 - 00:57:43 EST


On 2/22/22 7:48 AM, Jason Gunthorpe wrote:
since we should only care about ownership at probe, hotplug, and other
places well outside critical fast-paths, I'm not sure we really need to keep
track of that anyway - it can always be recalculated by walking the
group->devices list,
It has to be locked against concurrent probe, and there isn't
currently any locking scheme that can support this. The owner_cnt is
effectively a new lock for this purpose. It is the same issue we
talked about with that VFIO patch you showed me.

So, using the group->device_list would require adding something else
somewhere - which I think should happen when someone has
justification for another use of whatever that something else is.

This series was originated from the similar idea by adding some fields
in driver structure and intercepting it in iommu core. We stopped doing
that due to the lack of lock mechanism between iommu and driver core.
It then evolved into what it is today.

Best regards,
baolu