linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: alex.williamson@redhat.com
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Jason Gunthorpe <jgg@nvidia.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	kvm@vger.kernel.org, jgg@nvidia.com, peterx@redhat.com
Subject: [PATCH 0/7] vfio: device fd address space and vfio-pci mmap invalidation cleanup
Date: Thu, 05 Aug 2021 11:06:57 -0600	[thread overview]
Message-ID: <162818167535.1511194.6614962507750594786.stgit@omen> (raw)

vfio-pci currently goes through some pretty nasty locking algorithms
since commit abafbc551fdd ("vfio-pci: Invalidate mmaps and block MMIO
access on disabled memory") was added to invalidate and re-fault mmaps
to device MMIO around cases where device memory is disabled.  This
series greatly simplifies that by making use of an address space on
the vfio device file descriptor, as suggested by Jason Gunthorpe.
This allows us to use unmap_mapping_range() on the device fd to zap
such mappings, and by creating a vma-to-pfn callback, we can implement
a reverse function to restore all mappings.

This series was originally part of a larger series which also added a
callback to get a vfio device from a vma, which allows the IOMMU
backend to limit pfnmaps to vfio device memory.  The long term goal
is to implement the vma-to-pfn for all vfio device drivers to enable
this in the IOMMU backend and proceed with a mechanism to also
invalidate DMA mappings to device memory while disabled.

Given my slow progress towards that longer goal, I'd like to get this
in as an interim cleanup as it seems worthwhile on its own.  I'll
intend to rework this on top of Jason's device_open/close series.
Thanks,

Alex

---

Alex Williamson (7):
      vfio: Create vfio_fs_type with inode per device
      vfio: Export unmap_mapping_range() wrapper
      vfio/pci: Use vfio_device_unmap_mapping_range()
      vfio,vfio-pci: Add vma to pfn callback
      mm/interval_tree.c: Export vma interval tree iterators
      vfio: Add vfio_device_io_remap_mapping_range()
      vfio/pci: Remove map-on-fault behavior


 drivers/vfio/pci/vfio_pci.c         | 279 +++++++---------------------
 drivers/vfio/pci/vfio_pci_config.c  |   8 +-
 drivers/vfio/pci/vfio_pci_private.h |   5 +-
 drivers/vfio/vfio.c                 |  69 ++++++-
 include/linux/vfio.h                |  10 +
 mm/interval_tree.c                  |   3 +
 6 files changed, 156 insertions(+), 218 deletions(-)


             reply	other threads:[~2021-08-05 17:07 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-05 17:06 Alex Williamson [this message]
2021-08-05 17:07 ` [PATCH 1/7] vfio: Create vfio_fs_type with inode per device Alex Williamson
2021-08-10  8:43   ` Christoph Hellwig
2021-08-10 14:52     ` Alex Williamson
2021-08-10 14:57       ` Christoph Hellwig
2021-08-10 18:49         ` Peter Xu
2021-08-10 21:16           ` Alex Williamson
2021-08-10 22:18             ` Peter Xu
2021-08-05 17:07 ` [PATCH 2/7] vfio: Export unmap_mapping_range() wrapper Alex Williamson
2021-08-10  8:45   ` Christoph Hellwig
2021-08-10 18:56   ` Peter Xu
2021-08-05 17:07 ` [PATCH 3/7] vfio/pci: Use vfio_device_unmap_mapping_range() Alex Williamson
2021-08-06  1:04   ` Jason Gunthorpe
2021-08-06 20:17     ` Alex Williamson
2021-08-10  8:51       ` Christoph Hellwig
2021-08-10 11:57         ` Jason Gunthorpe
2021-08-10 12:55           ` Christoph Hellwig
2021-08-10 21:50             ` Alex Williamson
2021-08-11 11:57               ` Jason Gunthorpe
2021-08-10  8:53   ` Christoph Hellwig
2021-08-10 19:02     ` Peter Xu
2021-08-10 20:51       ` Alex Williamson
2021-08-10 18:48   ` Peter Xu
2021-08-10 19:59     ` Alex Williamson
2021-08-10 20:20       ` Peter Xu
2021-08-05 17:07 ` [PATCH 4/7] vfio,vfio-pci: Add vma to pfn callback Alex Williamson
2021-08-06  1:01   ` Jason Gunthorpe
2021-08-10  9:00     ` Christoph Hellwig
2021-08-10  9:00   ` Christoph Hellwig
2021-08-05 17:08 ` [PATCH 5/7] mm/interval_tree.c: Export vma interval tree iterators Alex Williamson
2021-08-05 17:08 ` [PATCH 6/7] vfio: Add vfio_device_io_remap_mapping_range() Alex Williamson
2021-08-10  9:04   ` Christoph Hellwig
2021-08-05 17:08 ` [PATCH 7/7] vfio/pci: Remove map-on-fault behavior Alex Williamson
2021-08-10  9:11   ` Christoph Hellwig
2021-08-10 15:04     ` Alex Williamson
2021-08-10 20:54   ` Peter Xu
2021-08-10 21:45     ` Alex Williamson
2021-08-10 22:27       ` Peter Xu

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=162818167535.1511194.6614962507750594786.stgit@omen \
    --to=alex.williamson@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=jgg@nvidia.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=peterx@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).