All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Jason Wang <jasowang@redhat.com>
Cc: Max Gurtovoy <mgurtovoy@nvidia.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	"virtio-comment@lists.oasis-open.org"
	<virtio-comment@lists.oasis-open.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"cohuck@redhat.com" <cohuck@redhat.com>,
	Parav Pandit <parav@nvidia.com>,
	Shahaf Shuler <shahafs@nvidia.com>, Ariel Adam <aadam@redhat.com>,
	Amnon Ilan <ailan@redhat.com>, Bodong Wang <bodong@nvidia.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Eugenio Perez Martin <eperezma@redhat.com>,
	Liran Liss <liranl@nvidia.com>, Oren Duer <oren@nvidia.com>
Subject: Re: [virtio-comment] Live Migration of Virtio Virtual Function
Date: Wed, 25 Aug 2021 15:13:48 -0300	[thread overview]
Message-ID: <20210825181348.GL1721383@nvidia.com> (raw)
In-Reply-To: <CACGkMEvxmJcgjdTQHoN=cR5xkqT5-QvQV1vPbzif51im7s4hPQ@mail.gmail.com>

On Wed, Aug 25, 2021 at 12:58:01PM +0800, Jason Wang wrote:
> On Tue, Aug 24, 2021 at 9:10 PM Jason Gunthorpe <jgg@nvidia.com> wrote:
> >
> > On Tue, Aug 24, 2021 at 10:41:54AM +0800, Jason Wang wrote:
> >
> > > > migration exposed to the guest ? No.
> > >
> > > Can you explain why?
> >
> > For the SRIOV case migration is a privileged operation of the
> > hypervisor. The guest must not be allowed to interact with it in any
> > way otherwise the hypervisor migration could be attacked from the
> > guest and this has definite security implications.
> >
> > In practice this means that nothing related to migration can be
> > located on the MMIO pages/queues/etc of the VF. The reasons for this
> > are a bit complicated and has to do with the limitations of IO
> > isolation with VFIO - eg you can't reliably split a single PCI BDF
> > into hypervisor/guest security domains without PASID.
> 
> So exposing the migration function can be done indirectly:
> 
> In L0, the hardware implements the function via PF, Qemu will present
> an emulated PCI device then Qemu can expose those functions via a
> capability for L1 guests. When L1 driver tries to use those functions,
> it goes:
> 
> L1 virtio-net driver -(emulated PCI-E BAR)-> Qemu -(ioctl)-> L0 kernel
> VF driver -> L0 kernel PF driver -(virtio interface)-> virtio PF
> 
> In this approach, there's no way for the L1 driver to control the or
> see what is implemented in the hardware (PF). The details were hidden
> by Qemu. This works even if DMA is required for the L0 kernel PF
> driver to talk with the hardware since for L1 we didn't present a DMA
> interface. With the future PASID support, we can even present a DMA
> interface to L1.

Sure, you can do this, but that isn't what is being talked about here,
and honestly seems like a highly contrived use case.

Further, in this mode I'd expect the hypervisor kernel driver to
provide the migration support without requiring any special HW
function.

> > I see in this thread that these two things are becoming quite
> > confused. They are very different, have different security postures
> > and use different parts of the hypervisor stack, and intended for
> > quite different use cases.
> 
> It looks like the full PCI VF could go via the virtio-pci vDPA driver
> as well (drivers/vdpa/virtio-pci). So what's the advantages of
> exposing the migration of virtio via vfio instead of vhost-vDPA? 

Can't say, both are possibly valid approaches with different trade
offs.

Off hand I think it is just unneeded complexity to use VDPA if the
device is already exposing a fully functional virtio-pci interface. I
see VDPA as being useful to create HW accelerated virtio interface
from HW that does not natively speak full virtio.

> 1) migration compatibility with the existing software virtio and
> vhost/vDPA implementations

IMHO the the virtio spec should define the format of the migration
state and I'd expect interworking between all the different
implementations.

> > I agree it would be good spec design to have a general concept of a
> > secure and guest world and specific sections that defines how it works
> > for different scenarios, but that seems like a language remark and not
> > one about the design. For instance the admin queue Max is adding is
> > clearly part of the secure world and putting it on the PF is the only
> > option for the SRIOV mode.
> 
> Yes, but let's move common functionality that is required for all
> transports to the chapter of "basic device facility". We don't need to
> define how it works in other different scenarios now.

It seems like a reasonable way to write the spec. I'd define a secure
admin queue and define how the ops on that queue work

Then seperately define how to instantiate the secure admin queue in
all the relevant scenarios.

Jason


  reply	other threads:[~2021-08-25 18:13 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-12 12:08 Live Migration of Virtio Virtual Function Max Gurtovoy
2021-08-17  8:51 ` [virtio-comment] " Jason Wang
2021-08-17  9:11   ` Max Gurtovoy
2021-08-17  9:44     ` Jason Wang
2021-08-18  9:15       ` Max Gurtovoy
2021-08-18 10:46         ` Jason Wang
2021-08-18 11:45           ` Max Gurtovoy
2021-08-19  2:44             ` Jason Wang
2021-08-19 14:58               ` Michael S. Tsirkin
2021-08-20  2:17                 ` Jason Wang
2021-08-20  7:03                   ` Michael S. Tsirkin
2021-08-20  7:49                     ` Jason Wang
2021-08-20 11:06                       ` Michael S. Tsirkin
2021-08-23  3:20                         ` Jason Wang
2021-08-23 12:08                   ` Dr. David Alan Gilbert
2021-08-24  3:00                     ` Jason Wang
2021-08-19 11:12             ` Dr. David Alan Gilbert
2021-08-19 14:16               ` Max Gurtovoy
2021-08-19 14:24                 ` Dr. David Alan Gilbert
2021-08-19 15:20                   ` Max Gurtovoy
2021-08-20  2:24                     ` Jason Wang
2021-08-20 10:26                       ` Max Gurtovoy
2021-08-20 11:16                         ` Jason Wang
2021-08-22 10:05                           ` Max Gurtovoy
2021-08-23  3:10                             ` Jason Wang
2021-08-23  8:55                               ` Max Gurtovoy
2021-08-24  2:41                                 ` Jason Wang
2021-08-24 13:10                                   ` Jason Gunthorpe
2021-08-25  4:58                                     ` Jason Wang
2021-08-25 18:13                                       ` Jason Gunthorpe [this message]
2021-08-26  3:15                                         ` Jason Wang
2021-08-26 12:27                                           ` Jason Gunthorpe
2021-08-23 12:18                     ` Dr. David Alan Gilbert

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=20210825181348.GL1721383@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=aadam@redhat.com \
    --cc=ailan@redhat.com \
    --cc=bodong@nvidia.com \
    --cc=cohuck@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=eperezma@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=liranl@nvidia.com \
    --cc=mgurtovoy@nvidia.com \
    --cc=mst@redhat.com \
    --cc=oren@nvidia.com \
    --cc=parav@nvidia.com \
    --cc=shahafs@nvidia.com \
    --cc=stefanha@redhat.com \
    --cc=virtio-comment@lists.oasis-open.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 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.