Re: [PATCH v1 05/16] iommufd/viommu: Add IOMMU_VIOMMU_SET/UNSET_VDEV_ID ioctl

Jason Gunthorpe
2024-08-15T23:42:13Z

On Thu, Aug 15, 2024 at 12:53:04PM -0700, Nicolin Chen wrote:

> > Maybe the iommufd_viommu_invalidate ioctl handler should hold that
> > xa_lock around the viommu->ops->cache_invalidate, and then add lock
> > assert in iommufd_viommu_find_device?
>
> xa_lock/spinlock might be too heavy. We can have a mutex to wrap
> around viommu ioctl handlers..

A rw semaphore might be reasonable.

Jason