Thread (77 messages) 77 messages, 5 authors, 2025-06-26

Re: [PATCH v6 07/25] iommufd/access: Add internal APIs for HW queue to use

From: Jason Gunthorpe <jgg@nvidia.com>
Date: 2025-06-17 11:55:19
Also in: linux-doc, linux-iommu, linux-kselftest, linux-patches, linux-tegra, lkml

On Tue, Jun 17, 2025 at 12:23:20PM +0800, Baolu Lu wrote:
On 6/17/25 10:25, Nicolin Chen wrote:
quoted
quoted
quoted
  struct iommufd_eventq {
  	struct iommufd_object obj;
  	struct iommufd_ctx *ictx;
diff --git a/drivers/iommu/iommufd/device.c b/drivers/iommu/iommufd/device.c
index 9293722b9cff..ad33f1e41a24 100644
--- a/drivers/iommu/iommufd/device.c
+++ b/drivers/iommu/iommufd/device.c
@@ -1084,7 +1084,39 @@ void iommufd_access_destroy_object(struct iommufd_object *obj)
  	if (access->ioas)
  		WARN_ON(iommufd_access_change_ioas(access, NULL));
  	mutex_unlock(&access->ioas_lock);
-	iommufd_ctx_put(access->ictx);
+	if (access->ops)
+		iommufd_ctx_put(access->ictx);
I was hoping we could null the ictx to signal internal? That didn't
work out?
access->ictx should be NULL for internal. It should have been:
+	if (access->ictx)
+		iommufd_ctx_put(access->ictx);
access->ictx could be treated as user ownership token. If it's NULL,
there is no user ownership, indicating it's owned by the kernel. This is
the concept here?
Yes

Jason
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help