[PATCH v2 13/22] iommufd: Add mmap interface
Jason Gunthorpe
jgg at nvidia.com
Mon May 5 10:28:13 PDT 2025
On Mon, May 05, 2025 at 10:21:03AM -0700, Nicolin Chen wrote:
> > > > +void iommufd_ctx_free_mmap(struct iommufd_ctx *ictx, unsigned long immap_id)
> > > > +{
> > > > + kfree(mtree_erase(&ictx->mt_mmap, immap_id >> PAGE_SHIFT));
> > >
> > > MMIO lifecycle question: what happens if a region is removed from the
> > > maple tree (and is therefore no longer mappable), but is still mapped
> > > and in use by userspace?
> >
> > I think we should probably zap it and make any existing VMAs
> > SIGBUS... Otherwise it is hard to reason about from the kernel side
>
> I added in v3 a pair of open/close op that would refcount the
> vIOMMU object (owner of the mmap region). This would EBUSY the
> vIOMMU destroy ioctl that would call this function.
That's no good, we can't have VMAs prevent cleaning up iommufd
objects, the right thing is to zap it with invalidate_mapping_range()
Jason
More information about the linux-arm-kernel
mailing list