[Intel-gfx] [PATCH v8 16/24] iommufd/device: Add iommufd_access_detach() API

Nicolin Chen nicolinc at nvidia.com
Tue Mar 28 15:54:52 UTC 2023


On Mon, Mar 27, 2023 at 07:23:57PM -0700, Jon Pan-Doh wrote:
> External email: Use caution opening links or attachments
> 
> 
> On 2023/3/27 02:40, Yi Liu wrote:
> > diff --git a/drivers/iommu/iommufd/iommufd_private.h b/drivers/iommu/iommufd/iommufd_private.h
> > index 2e6e8e217cce..ec2ce3ef187d 100644
> > --- a/drivers/iommu/iommufd/iommufd_private.h
> > +++ b/drivers/iommu/iommufd/iommufd_private.h
> > @@ -263,6 +263,8 @@ struct iommufd_access {
> >       struct iommufd_object obj;
> >       struct iommufd_ctx *ictx;
> >       struct iommufd_ioas *ioas;
> > +     struct iommufd_ioas *ioas_unpin;
> > +     struct mutex ioas_lock;
> >       const struct iommufd_access_ops *ops;
> >       void *data;
> >       unsigned long iova_alignment;
> 
> I think you may need to initialize ioas_lock. I got lockdep warnings running
> iommufd selftests against this patch. Those went away when I added mutex_init().
> 
> ---
>  drivers/iommu/iommufd/device.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/iommu/iommufd/device.c b/drivers/iommu/iommufd/device.c
> index f0522d80919d..0eaae60f3537 100644
> --- a/drivers/iommu/iommufd/device.c
> +++ b/drivers/iommu/iommufd/device.c
> @@ -474,6 +474,7 @@ iommufd_access_create(struct iommufd_ctx *ictx,
>         iommufd_ctx_get(ictx);
>         iommufd_object_finalize(ictx, &access->obj);
>         *id = access->obj.id;
> +       mutex_init(&access->ioas_lock);
>         return access;
>  }
>  EXPORT_SYMBOL_NS_GPL(iommufd_access_create, IOMMUFD);
> --
> 2.40.0.348.gf938b09366-goog

Yes... I think I lost that when splitting the changes.

Yi, can you help add this in the next version? 

Thanks!
Nicolin


More information about the Intel-gfx mailing list