All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony DeRossi <ajderossi@gmail.com>
To: kvm@vger.kernel.org
Cc: alex.williamson@redhat.com, cohuck@redhat.com, jgg@nvidia.com,
	kevin.tian@intel.com, abhsahu@nvidia.com, yishaih@nvidia.com
Subject: [PATCH v6 0/3] vfio/pci: Check the device set open count on reset
Date: Wed,  9 Nov 2022 17:40:24 -0800	[thread overview]
Message-ID: <20221110014027.28780-1-ajderossi@gmail.com> (raw)

This series fixes an issue where devices bound to vfio-pci are not reset when
they are released. Skipping the reset has unpredictable results depending on
the device, and can cause errors when accessing the device later or binding to
a different driver.

The first patch in this series fixes a life cycle issue that was discovered in
an earlier revision of the series.

Thank you Alex, Jason, and Kevin for your reviews and feedback. This revision
includes the changes suggested on v5, but without any changes to
vfio_device_set_open_count().

Anthony

v5 -> v6:
- Added a call to lockdep_assert_held() in patch 3
- Corrected "vfio_container_device_register()" in the patch 1 commit message
v5: https://lore.kernel.org/kvm/20221105224458.8180-1-ajderossi@gmail.com/

v4 -> v5:
- Replaced patch 2 with a patch that introduces a new function to get the
  open count of a device set
- Updated patch 3 to use the new function
v4: https://lore.kernel.org/kvm/20221104195727.4629-1-ajderossi@gmail.com/

v3 -> v4:
- Added a patch to fix device registration life cycle
- Added a patch to add a public open_count on vfio_device_set
- Changed the implementation to avoid private open_count usage
v3: https://lore.kernel.org/kvm/20221102055732.2110-1-ajderossi@gmail.com/

v2 -> v3:
- Added WARN_ON()
- Revised commit message
v2: https://lore.kernel.org/kvm/20221026194245.1769-1-ajderossi@gmail.com/

v1 -> v2:
- Changed reset behavior instead of open_count ordering
- Retitled from "vfio: Decrement open_count before close_device()"
v1: https://lore.kernel.org/kvm/20221025193820.4412-1-ajderossi@gmail.com/

Anthony DeRossi (3):
  vfio: Fix container device registration life cycle
  vfio: Export the device set open count
  vfio/pci: Check the device set open count on reset

 drivers/vfio/pci/vfio_pci_core.c | 10 +++++-----
 drivers/vfio/vfio_main.c         | 26 +++++++++++++++++++++-----
 include/linux/vfio.h             |  1 +
 3 files changed, 27 insertions(+), 10 deletions(-)

-- 
2.37.4


             reply	other threads:[~2022-11-10  1:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-10  1:40 Anthony DeRossi [this message]
2022-11-10  1:40 ` [PATCH v6 1/3] vfio: Fix container device registration life cycle Anthony DeRossi
2022-11-10  2:36   ` Yi Liu
2022-11-10  1:40 ` [PATCH v6 2/3] vfio: Export the device set open count Anthony DeRossi
2022-11-10  2:46   ` Yi Liu
2022-11-10  1:40 ` [PATCH v6 3/3] vfio/pci: Check the device set open count on reset Anthony DeRossi
2022-11-10  3:03   ` Yi Liu
2022-11-10  4:17     ` Alex Williamson
2022-11-10  4:33       ` Yi Liu
2022-11-10 20:16 ` [PATCH v6 0/3] " 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=20221110014027.28780-1-ajderossi@gmail.com \
    --to=ajderossi@gmail.com \
    --cc=abhsahu@nvidia.com \
    --cc=alex.williamson@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=jgg@nvidia.com \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=yishaih@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.