Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: kvm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, alex.williamson@redhat.com
Subject: [PATCH 0/5] vfio/pci: Device request support
Date: Wed, 04 Feb 2015 09:12:45 -0700	[thread overview]
Message-ID: <20150204155247.29468.20260.stgit@gimli.home> (raw)

Currently when the host kernel attempts to unbind an in-use device
from a vfio driver, we simply block until userspace releases the
device.  With a cooperative userspace client, we can do better (we can
potentially do better with a non-cooperative client too, but this
series does not attempt to address that).  Instead of idly waiting,
we can poke the vfio bus driver using a new device request callback.
For vfio-pci, this is exposed to the user as a new device management
interrupt, like the error reporting interrupt.  With a userspace
client like QEMU, this can be tied to an unplug request, allowing
for automatic removal of a device from a VM when an unbind request is
made on the host.  This of course presumes that the host operation
takes precedence over VM policy or else the VM would not choose to
be cooperative to the request.

A couple issues are fixed to make this reliable, the first being to
close a race where a driver stalled on an unbind can create a small
window where the vfio group is non-viable.  This can interfere with
attempts to acquire a group reference to match and release an
existing reference.  The other problem is that our IOMMU group ref
is tied to the device, so if the device is removed, the IOMMU group
can be removed, putting the vfio group in an awkward state.  The
reference is moved to the vfio group to prevent this.  The rest is
a straight forward addition of a callback and eventfd notifier path.
Thanks,

Alex

---

Alex Williamson (5):
      vfio-pci: Add device request interface
      vfio-pci: Generalize setup of simple eventfds
      vfio: Add and use device request op for vfio bus drivers
      vfio: Tie IOMMU group reference to vfio group
      vfio: Add device tracking during unbind


 drivers/vfio/pci/vfio_pci.c         |   21 ++++++
 drivers/vfio/pci/vfio_pci_intrs.c   |   60 +++++++++++++-----
 drivers/vfio/pci/vfio_pci_private.h |    1 
 drivers/vfio/vfio.c                 |  119 +++++++++++++++++++++++++++++++----
 include/linux/vfio.h                |    2 +
 include/uapi/linux/vfio.h           |    1 
 6 files changed, 173 insertions(+), 31 deletions(-)

             reply	other threads:[~2015-02-04 16:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-04 16:12 Alex Williamson [this message]
2015-02-04 16:12 ` [PATCH 1/5] vfio: Add device tracking during unbind Alex Williamson
2015-02-04 16:12 ` [PATCH 2/5] vfio: Tie IOMMU group reference to vfio group Alex Williamson
2015-02-04 16:13 ` [PATCH 3/5] vfio: Add and use device request op for vfio bus drivers Alex Williamson
2015-02-04 16:13 ` [PATCH 4/5] vfio-pci: Generalize setup of simple eventfds Alex Williamson
2015-02-04 16:13 ` [PATCH 5/5] vfio-pci: Add device request interface 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=20150204155247.29468.20260.stgit@gimli.home \
    --to=alex.williamson@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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