Re: [PATCH v3 07/11] iommufd/selftest: Add refcount to mock_iommu_device

2024-10-17 Thread Jason Gunthorpe
On Wed, Oct 09, 2024 at 09:38:07AM -0700, Nicolin Chen wrote: > For an iommu_dev that can unplug (so far only this selftest does so), the > viommu->iommu_dev pointer has no guarantee of its life cycle after it is > copied from the idev->dev->iommu->iommu_dev. > > Track the user count of the iommu_

[PATCH v3 07/11] iommufd/selftest: Add refcount to mock_iommu_device

2024-10-09 Thread Nicolin Chen
For an iommu_dev that can unplug (so far only this selftest does so), the viommu->iommu_dev pointer has no guarantee of its life cycle after it is copied from the idev->dev->iommu->iommu_dev. Track the user count of the iommu_dev. Delay the exit routine if refcount is unbalanced. The refcount inc/