[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250516132631.GG613512@nvidia.com>
Date: Fri, 16 May 2025 10:26:31 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: Nicolin Chen <nicolinc@...dia.com>
Cc: 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 v4 11/23] iommufd/viommu: Add IOMMUFD_CMD_HW_QUEUE_ALLOC
ioctl
On Thu, May 15, 2025 at 01:32:48PM -0700, Nicolin Chen wrote:
> On Thu, May 15, 2025 at 03:59:38PM -0300, Jason Gunthorpe wrote:
> > On Thu, May 15, 2025 at 11:16:45AM -0700, Nicolin Chen wrote:
> > > > I don't think this actually works like this without an unmap
> > > > callback. unmap will break:
> > > >
> > > > iommufd_access_notify_unmap(iopt, area_first, length);
> > > > /* Something is not responding to unmap requests. */
> > > > tries++;
> > > > if (WARN_ON(tries > 100))
> > > > return -EDEADLOCK;
> > > >
> > > > If it can't shoot down the pinning.
> > >
> > > Hmm, I thought we want the unmap to fail until VMM releases the HW
> > > QUEUE first? In what case, does VMM wants to unmap while holding
> > > the queue pages?
> >
> > Well, if that is what we want to do then this needs to be revised
> > somehow..
>
> Yea, unless we have a strong reason to allow unmap while holding
> the HW queue.
>
> I think we could set a new flag:
>
> enum {
> IOMMUFD_ACCESS_RW_READ = 0,
> IOMMUFD_ACCESS_RW_WRITE = 1 << 0,
> /* Set if the caller is in a kthread then rw will use kthread_use_mm() */
> IOMMUFD_ACCESS_RW_KTHREAD = 1 << 1,
> + IOMMUFD_ACCESS_NO_UNMAP = 1 << 3,
>
> /* Only for use by selftest */
> __IOMMUFD_ACCESS_RW_SLOW_PATH = 1 << 2,
> };
>
> and reject iopt_unmap_iova_range().
Okay, it would need a patch for this too. I think we wanted to limit
this no_unmap behavior though. Linking it to deliberate action that
the user took to create a vqueue with a user provided address seems
reasonable
I would probably put the flag out of the public header though, just to
prevent abuse from mdev drivers.
Jason
Powered by blists - more mailing lists