]> Git Repo - linux.git/commit - drivers/vfio/container.c
vfio: Move vfio_device_assign_container() into vfio_device_first_open()
authorJason Gunthorpe <[email protected]>
Tue, 29 Nov 2022 20:31:47 +0000 (16:31 -0400)
committerJason Gunthorpe <[email protected]>
Fri, 2 Dec 2022 15:52:03 +0000 (11:52 -0400)
commitbab6fabc01d99c7e0293807e835231740379b692
treeb7d0e509f059d386f6dc8adc4da286856f620183
parent294aaccb50130f596943be892c5d3a3568b76c57
vfio: Move vfio_device_assign_container() into vfio_device_first_open()

The only thing this function does is assert the group has an assigned
container and incrs refcounts.

The overall model we have is that once a container_users refcount is
incremented it cannot be de-assigned from the group -
vfio_group_ioctl_unset_container() will fail and the group FD cannot be
closed.

Thus we do not need to check this on every device FD open, just the
first. Reorganize the code so that only the first open and last close
manages the container.

Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Kevin Tian <[email protected]>
Reviewed-by: Yi Liu <[email protected]>
Reviewed-by: Alex Williamson <[email protected]>
Tested-by: Alex Williamson <[email protected]>
Tested-by: Nicolin Chen <[email protected]>
Tested-by: Yi Liu <[email protected]>
Tested-by: Lixiao Yang <[email protected]>
Tested-by: Matthew Rosato <[email protected]>
Tested-by: Yu He <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>
drivers/vfio/container.c
drivers/vfio/vfio_main.c
This page took 0.074536 seconds and 4 git commands to generate.