Re: [RFC 01/20] iommu/iommufd: Add /dev/iommu core

2021-10-19 Thread Jason Gunthorpe via iommu
On Tue, Oct 19, 2021 at 10:11:34AM -0700, Jacob Pan wrote: > Hi Jason, > > On Tue, 19 Oct 2021 13:57:47 -0300, Jason Gunthorpe wrote: > > > On Tue, Oct 19, 2021 at 09:57:34AM -0700, Jacob Pan wrote: > > > Hi Jason, > > > > > > On Fri, 15 Oct 2021 08:18:07 -0300, Jason Gunthorpe > > > wrote: >

Re: [RFC 01/20] iommu/iommufd: Add /dev/iommu core

2021-10-19 Thread Jacob Pan
Hi Jason, On Tue, 19 Oct 2021 13:57:47 -0300, Jason Gunthorpe wrote: > On Tue, Oct 19, 2021 at 09:57:34AM -0700, Jacob Pan wrote: > > Hi Jason, > > > > On Fri, 15 Oct 2021 08:18:07 -0300, Jason Gunthorpe > > wrote: > > > On Fri, Oct 15, 2021 at 09:18:06AM +, Liu, Yi L wrote: > > > > >

Re: [RFC 01/20] iommu/iommufd: Add /dev/iommu core

2021-10-19 Thread Jason Gunthorpe via iommu
On Tue, Oct 19, 2021 at 09:57:34AM -0700, Jacob Pan wrote: > Hi Jason, > > On Fri, 15 Oct 2021 08:18:07 -0300, Jason Gunthorpe wrote: > > > On Fri, Oct 15, 2021 at 09:18:06AM +, Liu, Yi L wrote: > > > > > > Acquire from the xarray is > > > >rcu_lock() > > > >ioas = xa_load() > > >

Re: [RFC 01/20] iommu/iommufd: Add /dev/iommu core

2021-10-19 Thread Jacob Pan
Hi Jason, On Fri, 15 Oct 2021 08:18:07 -0300, Jason Gunthorpe wrote: > On Fri, Oct 15, 2021 at 09:18:06AM +, Liu, Yi L wrote: > > > > Acquire from the xarray is > > >rcu_lock() > > >ioas = xa_load() > > >if (ioas) > > > if (down_read_trylock(&ioas->destroying_lock)) >

RE: [RFC 01/20] iommu/iommufd: Add /dev/iommu core

2021-10-15 Thread Liu, Yi L
> From: Jason Gunthorpe > Sent: Friday, October 15, 2021 7:18 PM > > On Fri, Oct 15, 2021 at 09:18:06AM +, Liu, Yi L wrote: > > > > Acquire from the xarray is > > >rcu_lock() > > >ioas = xa_load() > > >if (ioas) > > > if (down_read_trylock(&ioas->destroying_lock)) > > > >

Re: [RFC 01/20] iommu/iommufd: Add /dev/iommu core

2021-10-15 Thread Jason Gunthorpe via iommu
On Fri, Oct 15, 2021 at 09:18:06AM +, Liu, Yi L wrote: > > Acquire from the xarray is > >rcu_lock() > >ioas = xa_load() > >if (ioas) > > if (down_read_trylock(&ioas->destroying_lock)) > > all good suggestions, will refine accordingly. Here destroying_lock is a > rw_semapho

RE: [RFC 01/20] iommu/iommufd: Add /dev/iommu core

2021-10-15 Thread Liu, Yi L
> From: Jason Gunthorpe > Sent: Tuesday, September 21, 2021 11:42 PM > > On Sun, Sep 19, 2021 at 02:38:29PM +0800, Liu Yi L wrote: > > /dev/iommu aims to provide a unified interface for managing I/O address > > spaces for devices assigned to userspace. This patch adds the initial > > framework to

Re: [RFC 01/20] iommu/iommufd: Add /dev/iommu core

2021-09-22 Thread Jason Gunthorpe via iommu
On Wed, Sep 22, 2021 at 01:59:39PM +, Tian, Kevin wrote: > > From: Jason Gunthorpe > > Sent: Wednesday, September 22, 2021 8:41 PM > > > > On Wed, Sep 22, 2021 at 01:51:03AM +, Tian, Kevin wrote: > > > > From: Jason Gunthorpe > > > > Sent: Tuesday, September 21, 2021 11:42 PM > > > > > >

RE: [RFC 01/20] iommu/iommufd: Add /dev/iommu core

2021-09-22 Thread Tian, Kevin
> From: Jason Gunthorpe > Sent: Wednesday, September 22, 2021 8:41 PM > > On Wed, Sep 22, 2021 at 01:51:03AM +, Tian, Kevin wrote: > > > From: Jason Gunthorpe > > > Sent: Tuesday, September 21, 2021 11:42 PM > > > > > > - Delete the iommufd_ctx->lock. Use RCU to protect load, erase/alloc >

Re: [RFC 01/20] iommu/iommufd: Add /dev/iommu core

2021-09-22 Thread Jason Gunthorpe via iommu
On Wed, Sep 22, 2021 at 01:51:03AM +, Tian, Kevin wrote: > > From: Jason Gunthorpe > > Sent: Tuesday, September 21, 2021 11:42 PM > > > > - Delete the iommufd_ctx->lock. Use RCU to protect load, erase/alloc does > >not need locking (order it properly too, it is in the wrong order), and >

RE: [RFC 01/20] iommu/iommufd: Add /dev/iommu core

2021-09-21 Thread Tian, Kevin
> From: Jason Gunthorpe > Sent: Tuesday, September 21, 2021 11:42 PM > > - Delete the iommufd_ctx->lock. Use RCU to protect load, erase/alloc does >not need locking (order it properly too, it is in the wrong order), and >don't check for duplicate devices or dev_cookie duplication, that >

Re: [RFC 01/20] iommu/iommufd: Add /dev/iommu core

2021-09-21 Thread Jason Gunthorpe via iommu
On Sun, Sep 19, 2021 at 02:38:29PM +0800, Liu Yi L wrote: > /dev/iommu aims to provide a unified interface for managing I/O address > spaces for devices assigned to userspace. This patch adds the initial > framework to create a /dev/iommu node. Each open of this node returns an > iommufd. And this