RE: [PATCH 9/9] vfio: Remove calls to vfio_group_add_container_user()

2022-04-15 Thread Tian, Kevin
> From: Jason Gunthorpe > Sent: Friday, April 15, 2022 8:07 PM > > On Fri, Apr 15, 2022 at 02:32:08AM +, Tian, Kevin wrote: > > > While it's a welcomed fix is it actually related to this series? The point > > of this patch is that those functions are called when container_users > > is non-ze

Re: [PATCH 9/9] vfio: Remove calls to vfio_group_add_container_user()

2022-04-15 Thread Jason Gunthorpe
On Fri, Apr 15, 2022 at 02:32:08AM +, Tian, Kevin wrote: > While it's a welcomed fix is it actually related to this series? The point > of this patch is that those functions are called when container_users > is non-zero. This is true even without this fix given container_users > is decremented

Re: [PATCH 9/9] vfio: Remove calls to vfio_group_add_container_user()

2022-04-15 Thread Matthew Rosato
On 4/12/22 11:53 AM, Jason Gunthorpe wrote: When the open_device() op is called the container_users is incremented and held incremented until close_device(). Thus, so long as drivers call functions within their open_device()/close_device() region they do not need to worry about the container_user

RE: [PATCH 9/9] vfio: Remove calls to vfio_group_add_container_user()

2022-04-14 Thread Tian, Kevin
> From: Jason Gunthorpe > Sent: Thursday, April 14, 2022 10:22 PM > > On Thu, Apr 14, 2022 at 09:51:49AM -0400, Matthew Rosato wrote: > > On 4/12/22 11:53 AM, Jason Gunthorpe wrote: > > > When the open_device() op is called the container_users is incremented > and > > > held incremented until clo

Re: [PATCH 9/9] vfio: Remove calls to vfio_group_add_container_user()

2022-04-14 Thread Jason Gunthorpe
On Thu, Apr 14, 2022 at 09:51:49AM -0400, Matthew Rosato wrote: > On 4/12/22 11:53 AM, Jason Gunthorpe wrote: > > When the open_device() op is called the container_users is incremented and > > held incremented until close_device(). Thus, so long as drivers call > > functions within their open_devic

Re: [PATCH 9/9] vfio: Remove calls to vfio_group_add_container_user()

2022-04-13 Thread Jason Gunthorpe
On Wed, Apr 13, 2022 at 08:11:05AM +0200, Christoph Hellwig wrote: > On Tue, Apr 12, 2022 at 12:53:36PM -0300, Jason Gunthorpe wrote: > > + if (WARN_ON(!READ_ONCE(vdev->open_count))) > > + return -EINVAL; > > I think all the WARN_ON()s in this patch need to be WARN_ON_ONCE, > otherwise

[PATCH 9/9] vfio: Remove calls to vfio_group_add_container_user()

2022-04-12 Thread Jason Gunthorpe
When the open_device() op is called the container_users is incremented and held incremented until close_device(). Thus, so long as drivers call functions within their open_device()/close_device() region they do not need to worry about the container_users. These functions can all only be called bet