qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Rosato <mjrosato@linux.ibm.com>
To: alex.williamson@redhat.com, cohuck@redhat.com
Cc: thuth@redhat.com, pmorel@linux.ibm.com, david@redhat.com,
	schnelle@linux.ibm.com, qemu-devel@nongnu.org,
	pasic@linux.ibm.com, borntraeger@de.ibm.com,
	qemu-s390x@nongnu.org, rth@twiddle.net
Subject: [PATCH v2 0/3] s390x/pci: Accomodate vfio DMA limiting
Date: Mon, 14 Sep 2020 18:29:27 -0400	[thread overview]
Message-ID: <1600122570-12941-1-git-send-email-mjrosato@linux.ibm.com> (raw)

Kernel commit 492855939bdb added a limit to the number of outstanding DMA
requests for a type1 vfio container.  However, lazy unmapping in s390 can 
in fact cause quite a large number of outstanding DMA requests to build up
prior to being purged, potentially the entire guest DMA space.  This
results in unexpected 'VFIO_MAP_DMA failed: No space left on device'
conditions seen in QEMU.

This patchset adds support to qemu to retrieve the number of allowable DMA
requests via the VFIO_IOMMU_GET_INFO ioctl.  The patches are separated into
vfio hits which add support for reading in VFIO_IOMMU_GET_INFO capability
chains and getting the per-container dma_avail value, and s390 hits to 
track DMA usage on a per-container basis.

Associated kernel patch:
https://marc.info/?l=kvm&m=160012235303068&w=2

Changes from v2:
- Renamed references of dma_limit to dma_avail based on kernel change as
  the ioctl now reports the amount currently available vs the supposed
  limit.
- Because the ioctl now provides a 'living value' vs the limit, it doesn't
  seem appropriate to put it in the VFIOConatiner structure without
  doing the dma_avail tracking there.  So patch 1 shrinks to vfio helper
  routines to find the capability and leaves vfio_connect_container alone. 
- Subsequently, in patch 2 s390-pci issues its own VFIO_IOMMU_GET_INFO to
  read the dma_avail value and use it.

Matthew Rosato (3):
  vfio: Find DMA available capability
  s390x/pci: Honor DMA limits set by vfio
  vfio: Create shared routine for scanning info capabilities

 hw/s390x/s390-pci-bus.c       | 99 ++++++++++++++++++++++++++++++++++++++++---
 hw/s390x/s390-pci-bus.h       |  9 ++++
 hw/s390x/s390-pci-inst.c      | 29 ++++++++++---
 hw/s390x/s390-pci-inst.h      |  3 ++
 hw/vfio/common.c              | 50 ++++++++++++++++++----
 include/hw/vfio/vfio-common.h |  2 +
 6 files changed, 173 insertions(+), 19 deletions(-)

-- 
1.8.3.1



             reply	other threads:[~2020-09-14 22:32 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-14 22:29 Matthew Rosato [this message]
2020-09-14 22:29 ` [PATCH v2 1/3] vfio: Find DMA available capability Matthew Rosato
2020-09-15  6:14   ` Philippe Mathieu-Daudé
2020-09-15 10:10     ` Cornelia Huck
2020-09-15 13:39     ` Matthew Rosato
2020-09-15 10:33   ` Cornelia Huck
2020-09-15 13:57     ` Matthew Rosato
2020-09-15 14:37       ` Cornelia Huck
2020-09-14 22:29 ` [PATCH v2 2/3] s390x/pci: Honor DMA limits set by vfio Matthew Rosato
2020-09-15 11:28   ` Cornelia Huck
2020-09-15 14:16     ` Matthew Rosato
2020-09-15 14:50       ` Cornelia Huck
2020-09-15 12:54   ` Thomas Huth
2020-09-15 14:18     ` Matthew Rosato
2020-09-14 22:29 ` [PATCH v2 3/3] vfio: Create shared routine for scanning info capabilities Matthew Rosato
2020-09-15  6:16   ` Philippe Mathieu-Daudé
2020-09-15 13:43     ` Matthew Rosato

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=1600122570-12941-1-git-send-email-mjrosato@linux.ibm.com \
    --to=mjrosato@linux.ibm.com \
    --cc=alex.williamson@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=pasic@linux.ibm.com \
    --cc=pmorel@linux.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=schnelle@linux.ibm.com \
    --cc=thuth@redhat.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).