[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250714165346.GI2067380@nvidia.com>
Date: Mon, 14 Jul 2025 13:53:46 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: Xu Yilun <yilun.xu@...ux.intel.com>
Cc: Nicolin Chen <nicolinc@...dia.com>, kevin.tian@...el.com,
will@...nel.org, aneesh.kumar@...nel.org, iommu@...ts.linux.dev,
linux-kernel@...r.kernel.org, joro@...tes.org, robin.murphy@....com,
shuah@...nel.org, aik@....com, dan.j.williams@...el.com,
baolu.lu@...ux.intel.com, yilun.xu@...el.com
Subject: Re: [PATCH v4 4/7] iommufd: Destroy vdevice on idevice destroy
On Tue, Jul 15, 2025 at 12:40:40AM +0800, Xu Yilun wrote:
> diff --git a/drivers/iommu/iommufd/viommu.c b/drivers/iommu/iommufd/viommu.c
> index 702ae248df17..bdd5a5227cbf 100644
> --- a/drivers/iommu/iommufd/viommu.c
> +++ b/drivers/iommu/iommufd/viommu.c
> @@ -128,7 +128,8 @@ void iommufd_vdevice_destroy(struct iommufd_object *obj)
> mutex_lock(&idev->igroup->lock);
> iommufd_vdevice_abort(obj);
> mutex_unlock(&idev->igroup->lock);
> - iommufd_put_object(idev->ictx, &idev->obj);
> + refcount_dec(&idev->obj.shortterm_users);
> + wake_up_interruptible_all(&vdev->viommu->ictx->destroy_wait);
> }
I think the main point of keeping both refcounts is to keep the above
hidden in the main functions and out of the object functions.
Jason
Powered by blists - more mailing lists