qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: John G Johnson <john.g.johnson@oracle.com>
Cc: "Walker, Benjamin" <benjamin.walker@intel.com>,
	"Elena Ufimtseva" <elena.ufimtseva@oracle.com>,
	"Jag Raman" <jag.raman@oracle.com>,
	"Swapnil Ingle" <swapnil.ingle@nutanix.com>,
	"Harris, James R" <james.r.harris@intel.com>,
	"Konrad Rzeszutek Wilk" <konrad.wilk@oracle.com>,
	"Stefan Hajnoczi" <stefanha@gmail.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"Kirti Wankhede" <kwankhede@nvidia.com>,
	"Raphael Norwitz" <raphael.norwitz@nutanix.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Alex Williamson" <alex.williamson@redhat.com>,
	"Kanth Ghatraju" <Kanth.Ghatraju@oracle.com>,
	"Felipe Franciosi" <felipe@nutanix.com>,
	"Thanos Makatos" <thanos.makatos@nutanix.com>,
	"Zhang, Tina" <tina.zhang@intel.com>,
	"Liu, Changpeng" <changpeng.liu@intel.com>,
	"dgilbert@redhat.com" <dgilbert@redhat.com>
Subject: Re: RFC: use VFIO over a UNIX domain socket to implement device offloading
Date: Fri, 26 Jun 2020 14:30:20 +0100	[thread overview]
Message-ID: <20200626133020.GZ281902@stefanha-x1.localdomain> (raw)
In-Reply-To: <7B305CB0-0D5F-4FF8-ACDC-828AF37687B1@oracle.com>

[-- Attachment #1: Type: text/plain, Size: 2819 bytes --]

On Thu, Jun 25, 2020 at 08:54:25PM -0700, John G Johnson wrote:
> 
> 
> > On Jun 23, 2020, at 5:27 AM, Stefan Hajnoczi <stefanha@gmail.com> wrote:
> > 
> > On Thu, Jun 18, 2020 at 02:38:04PM -0700, John G Johnson wrote:
> >>> On Jun 15, 2020, at 3:49 AM, Stefan Hajnoczi <stefanha@redhat.com> wrote:
> >>> An issue with file descriptor passing is that it's hard to revoke access
> >>> once the file descriptor has been passed. memfd supports sealing with
> >>> fnctl(F_ADD_SEALS) it doesn't revoke mmap(MAP_WRITE) on other processes.
> >>> 
> >>> Memory Protection Keys don't seem to be useful here either and their
> >>> availability is limited (see pkeys(7)).
> >>> 
> >>> One crazy idea is to use KVM as a sandbox for running the device and let
> >>> the vIOMMU control the page tables instead of the device (guest). That
> >>> way the hardware MMU provides memory translation, but I think this is
> >>> impractical because the guest environment is too different from the
> >>> Linux userspace environment.
> >>> 
> >>> As a starting point adding DMA_READ/DMA_WRITE messages would provide the
> >>> functionality and security. Unfortunately it makes DMA expensive and
> >>> performance will suffer.
> >>> 
> >> 
> >> 	Are you advocating for only using VFIO_USER_DMA_READ/WRITE and
> >> not passing FDs at all?  The performance penalty would be large for the
> >> cases where the client and server are equally trusted.  Or are you
> >> advocating for an option where the slower methods are used for cases
> >> where the server is less trusted?
> > 
> > I think the enforcing IOMMU should be optional (due to the performance
> > overhead) but part of the spec from the start.
> > 
> 
> 
> 	With this in mind, we will collapse the current memory region
> messages (VFIO_USER_ADD_MEMORY_REGION and VFIO_USER_SUB_MEMORY_REGION)
> and the IOMMU messages (VFIO_USER_IOMMU_MAP and VFIO_USER_IOMMU_UNMAP)
> into new messages (VFIO_USER_DMA_MAP and VFIO_USER_DMA_UNMAP).  Their
> contents will be the same as the memory region messages.
> 
> 	On a system without an IOMMU, the new messages will be used to
> export the system physical address space as DMA addresses.  On a system
> with an IOMMU they will be used to export the valid device DMA ranges
> programmed into the IOMMU by the guest.  This behavior matches how the
> existing QEMU VFIO object programs the host IOMMU.  The server will not
> be aware of whether the client is using an IOMMU.
>
> 	In the QEMU VFIO implementation, will will add a ‘secure-dma’
> option that suppresses exporting mmap()able FDs to the server.  All
> DMA will use the slow path to be validated by the client before accessing
> guest memory.
> 
> 	Is this acceptable to you (and Alex, of course)?

Sounds good to me.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2020-06-26 13:31 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-26  9:47 RFC: use VFIO over a UNIX domain socket to implement device offloading Thanos Makatos
2020-03-27 10:37 ` Thanos Makatos
2020-04-01  9:17 ` Stefan Hajnoczi
2020-04-01 15:49   ` Thanos Makatos
2020-04-01 16:58     ` Marc-André Lureau
2020-04-02 10:19       ` Stefan Hajnoczi
2020-04-02 10:46         ` Daniel P. Berrangé
2020-04-03 12:03           ` Stefan Hajnoczi
2020-04-20 11:05   ` Thanos Makatos
2020-04-22 15:29     ` Stefan Hajnoczi
2020-04-27 10:58       ` Thanos Makatos
2020-04-30 11:23         ` Thanos Makatos
2020-04-30 11:40           ` Daniel P. Berrangé
2020-04-30 15:20             ` Thanos Makatos
2020-05-01 15:01               ` Felipe Franciosi
2020-05-01 15:28                 ` Daniel P. Berrangé
2020-05-04  9:45                   ` Stefan Hajnoczi
2020-05-04 17:49                     ` John G Johnson
2020-05-11 14:37                       ` Stefan Hajnoczi
2020-05-14 16:32     ` John G Johnson
2020-05-14 19:20       ` Alex Williamson
2020-05-21  0:45       ` John G Johnson
2020-06-02 15:06         ` Alex Williamson
2020-06-10  6:25           ` John G Johnson
2020-06-15 10:49             ` Stefan Hajnoczi
2020-06-18 21:38               ` John G Johnson
2020-06-23 12:27                 ` Stefan Hajnoczi
2020-06-26  3:54                   ` John G Johnson
2020-06-26 13:30                     ` Stefan Hajnoczi [this message]
2020-07-02  6:23                       ` John G Johnson
2020-07-15 10:15                         ` Stefan Hajnoczi

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=20200626133020.GZ281902@stefanha-x1.localdomain \
    --to=stefanha@redhat.com \
    --cc=Kanth.Ghatraju@oracle.com \
    --cc=alex.williamson@redhat.com \
    --cc=benjamin.walker@intel.com \
    --cc=changpeng.liu@intel.com \
    --cc=dgilbert@redhat.com \
    --cc=elena.ufimtseva@oracle.com \
    --cc=felipe@nutanix.com \
    --cc=jag.raman@oracle.com \
    --cc=james.r.harris@intel.com \
    --cc=john.g.johnson@oracle.com \
    --cc=konrad.wilk@oracle.com \
    --cc=kwankhede@nvidia.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=raphael.norwitz@nutanix.com \
    --cc=stefanha@gmail.com \
    --cc=swapnil.ingle@nutanix.com \
    --cc=thanos.makatos@nutanix.com \
    --cc=tina.zhang@intel.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).