kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Alex Williamson <alex.williamson@redhat.com>,
	Cornelia Huck <cohuck@redhat.com>,
	kvm@vger.kernel.org
Cc: Xiao Guangrong <guangrong.xiao@linux.intel.com>,
	Jike Song <jike.song@intel.com>,
	Kevin Tian <kevin.tian@intel.com>,
	Kirti Wankhede <kwankhede@nvidia.com>,
	Nicolin Chen <nicolinc@nvidia.com>
Subject: [PATCH v2 0/6] Fully lock the container members of struct vfio_group
Date: Mon, 16 May 2022 20:41:16 -0300	[thread overview]
Message-ID: <0-v2-d035a1842d81+1bf-vfio_group_locking_jgg@nvidia.com> (raw)

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


             reply	other threads:[~2022-05-16 23:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-16 23:41 Jason Gunthorpe [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0-v2-d035a1842d81+1bf-vfio_group_locking_jgg@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=alex.williamson@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=guangrong.xiao@linux.intel.com \
    --cc=jike.song@intel.com \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=kwankhede@nvidia.com \
    --cc=nicolinc@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).