public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/6] Fully lock the container members of struct vfio_group
@ 2022-05-16 23:41 Jason Gunthorpe
  2022-05-16 23:41 ` [PATCH v2 1/6] vfio: Add missing locking for struct vfio_group::kvm Jason Gunthorpe
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: Jason Gunthorpe @ 2022-05-16 23:41 UTC (permalink / raw)
  To: Alex Williamson, Cornelia Huck, kvm
  Cc: Xiao Guangrong, Jike Song, Kevin Tian, Kirti Wankhede,
	Nicolin Chen

The atomic based scheme for tracking the group->container and group->kvm
has two race conditions, simplify it by adding a rwsem to protect those
values and related and remove the atomics.

This is on github: https://github.com/jgunthorpe/linux/commits/vfio_group_locking

v2:
 - Updated comments and commit messages
 - Rebased on vfio next
 - Left the dev_warn in place, will adjust it later
 - s/singleton_file/opened_file/
v1: https://lore.kernel.org/r/0-v1-c1d14aae2e8f+2f4-vfio_group_locking_jgg@nvidia.com

Cc: Nicolin Chen <nicolinc@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>

Jason Gunthorpe (6):
  vfio: Add missing locking for struct vfio_group::kvm
  vfio: Change struct vfio_group::opened from an atomic to bool
  vfio: Split up vfio_group_get_device_fd()
  vfio: Fully lock struct vfio_group::container
  vfio: Simplify the life cycle of the group FD
  vfio: Change struct vfio_group::container_users to a non-atomic int

 drivers/vfio/vfio.c | 266 +++++++++++++++++++++++++++-----------------
 1 file changed, 163 insertions(+), 103 deletions(-)


base-commit: 6a985ae80befcf2c00e7c889336bfe9e9739e2ef
-- 
2.36.0


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-05-18 17:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-16 23:41 [PATCH v2 0/6] Fully lock the container members of struct vfio_group Jason Gunthorpe
2022-05-16 23:41 ` [PATCH v2 1/6] vfio: Add missing locking for struct vfio_group::kvm Jason Gunthorpe
2022-05-16 23:41 ` [PATCH v2 2/6] vfio: Change struct vfio_group::opened from an atomic to bool Jason Gunthorpe
2022-05-16 23:41 ` [PATCH v2 3/6] vfio: Split up vfio_group_get_device_fd() Jason Gunthorpe
2022-05-16 23:41 ` [PATCH v2 4/6] vfio: Fully lock struct vfio_group::container Jason Gunthorpe
2022-05-16 23:41 ` [PATCH v2 5/6] vfio: Simplify the life cycle of the group FD Jason Gunthorpe
2022-05-16 23:41 ` [PATCH v2 6/6] vfio: Change struct vfio_group::container_users to a non-atomic int Jason Gunthorpe
2022-05-17  5:11 ` [PATCH v2 0/6] Fully lock the container members of struct vfio_group Nicolin Chen
2022-05-17 15:37   ` Matthew Rosato
2022-05-18 17:51 ` Alex Williamson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox