[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250507123648.GE90261@nvidia.com>
Date: Wed, 7 May 2025 09:36:48 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: Nicolin Chen <nicolinc@...dia.com>
Cc: Baolu Lu <baolu.lu@...ux.intel.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
Subject: Re: [PATCH v2 13/22] iommufd: Add mmap interface
On Tue, May 06, 2025 at 01:54:10PM -0700, Nicolin Chen wrote:
> Now I start to think about the FD situation: either a fault queue or
> an eventq returns an FD and holds a refcount on the event object. So
> the event object can't be destroyed unless the FD is released first.
> Are we doing it incorrectly here?
Not necessarily, and maybe that is a good point that we are already
doing these cross dependencies. But we could fix the FDs with some
work too.
> I see! It just needs to call that function when we remove the mmap
> for a vIOMMU destroy().
It is a little fussy to setup the inode as well, but yes.
The other small advantage is you don't need to setup a special VMA ops
and do VMA tracking to hold the refcount on the vqueue object.
But there is also any annoying race with unmap in setting up the mmap
PFNs which is why vfio is doing it from a fault handler..
So maybe refcount is the simplest option for now. We could fix it
later and it won't prevent close() from working right.
Jason
Powered by blists - more mailing lists