[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250617115515.GT1174925@nvidia.com>
Date: Tue, 17 Jun 2025 08:55:15 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: Baolu Lu <baolu.lu@...ux.intel.com>
Cc: Nicolin Chen <nicolinc@...dia.com>, kevin.tian@...el.com,
corbet@....net, will@...nel.org, bagasdotme@...il.com,
robin.murphy@....com, joro@...tes.org, thierry.reding@...il.com,
vdumpa@...dia.com, jonathanh@...dia.com, shuah@...nel.org,
jsnitsel@...hat.com, nathan@...nel.org, peterz@...radead.org,
yi.l.liu@...el.com, mshavit@...gle.com, praan@...gle.com,
zhangzekun11@...wei.com, iommu@...ts.linux.dev,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-tegra@...r.kernel.org,
linux-kselftest@...r.kernel.org, patches@...ts.linux.dev,
mochs@...dia.com, alok.a.tiwari@...cle.com, vasant.hegde@....com,
dwmw2@...radead.org
Subject: Re: [PATCH v6 07/25] iommufd/access: Add internal APIs for HW queue
to use
On Tue, Jun 17, 2025 at 12:23:20PM +0800, Baolu Lu wrote:
> On 6/17/25 10:25, Nicolin Chen wrote:
> > > > 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
Powered by blists - more mailing lists