All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: "Marcel Apfelbaum" <marcel@redhat.com>, 陈博 <chenbo02@meituan.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] About virtio device hotplug in Q35! 【外域邮件.谨慎查阅】
Date: Wed, 26 Jul 2017 11:32:22 -0600	[thread overview]
Message-ID: <20170726113222.52aad9a6@w520.home> (raw)
In-Reply-To: <20170726190348-mutt-send-email-mst@kernel.org>

On Wed, 26 Jul 2017 19:06:58 +0300
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Wed, Jul 26, 2017 at 09:29:31AM -0600, Alex Williamson wrote:
> > On Wed, 26 Jul 2017 09:21:38 +0300
> > Marcel Apfelbaum <marcel@redhat.com> wrote:
> >   
> > > On 25/07/2017 11:53, 陈博 wrote:  
> > > > To accelerate data traversing between devices under the same PCIE Root 
> > > > Port or Switch.
> > > > 
> > > > See https://lists.nongnu.org/archive/html/qemu-devel/2017-07/msg07209.html
> > > >     
> > > 
> > > Hi,
> > > 
> > > It may be possible, but maybe PCIe Switch assignment is not
> > > the only way to go.
> > > 
> > > Adding Alex and Michael for their input on this matter.
> > > More info at:
> > > https://lists.nongnu.org/archive/html/qemu-devel/2017-07/msg07209.html  
> > 
> > I think you need to look at where the IOMMU is in the topology and what
> > address space the devices are working in when assigned to a VM to
> > realize that it doesn't make any sense to assign switch ports to a VM.
> > GPUs cannot do switch level peer to peer when assigned because they are
> > operating in an I/O virtual address space.  This is why we configure
> > ACS on downstream ports to prevent peer to peer.  Peer to peer
> > transactions must be forwarded upstream by the switch ports in order to
> > reach the IOMMU for translation.  Note however that we do populate peer
> > to peer mappings within the IOMMU, so if the hardware supports it, the
> > IOMMU can reflect the transaction back out to the I/O bus to reach the
> > other device without CPU involvement.
> > 
> > Therefore I think the better solution, if it encourages the NVIDIA
> > driver to do the right thing, is to use emulated switches.  Assigning
> > the physical switch would really do nothing more than make the PCIe link
> > information more correct in the VM, everything else about the switch
> > would be emulated.  Even still, unless you have an I/O topology which
> > integrates the IOMMU into the switch itself, the data flow still needs
> > to go all the way to the root complex to hit the IOMMU before being
> > reflected to the other device.  Direct peer to peer between downstream
> > switch ports operates in the wrong address space.  Thanks,
> > 
> > Alex  
> 
> That's true of course. What would make sense would be for
> hardware vendors to add ATS support to their cards.
> 
> Then peer to peer should be allowed by hypervisor for translated transactions.
> 
> Gives you the performance benefit without the security issues.
> 
> Does anyone know whether any hardware implements this?

GPUs often do implement ATS and the ACS DT (Direct Translated P2P)
capability should handle routing requests with the Address Type field
indicating a translated address directly between downstream ports.  DT
is however not part of the standard set of ACS bits that we enable.  It
seems like it might be fairly easy to poke the DT enable bit with
setpci from userspace to test whether this "just works", providing of
course you can get the driver to attempt to do peer to peer and ATS is
already functioning on the GPU.  If so, then we should look at where
in the code to do that enabling automatically.  Thanks,

Alex

  reply	other threads:[~2017-07-26 17:32 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4E0AFA5F-44D6-4624-A99F-68A7FE52F397@meituan.com>
     [not found] ` <4b31a711-a52e-25d3-4a7c-1be8521097d9@redhat.com>
     [not found]   ` <F99BFE80-FC15-40A0-BB3E-1B53B6CF9B05@meituan.com>
2017-07-26  6:21     ` [Qemu-devel] About virtio device hotplug in Q35! 【外域邮件.谨慎查阅】 Marcel Apfelbaum
2017-07-26 15:29       ` Alex Williamson
2017-07-26 16:06         ` Michael S. Tsirkin
2017-07-26 17:32           ` Alex Williamson [this message]
2017-08-01  5:04             ` Bob Chen
2017-08-01  5:46               ` Alex Williamson
2017-08-01  9:35                 ` Bob Chen
2017-08-01 14:39                   ` Michael S. Tsirkin
2017-08-01 15:01                   ` Alex Williamson
2017-08-07 13:00                     ` Bob Chen
2017-08-07 15:52                       ` Alex Williamson
2017-08-08  1:44                         ` Bob Chen
2017-08-08  8:06                           ` Bob Chen
2017-08-08 16:53                           ` Alex Williamson
2017-08-08 20:07                         ` Michael S. Tsirkin
2017-08-22  7:04                           ` Bob Chen
2017-08-22 16:56                             ` Alex Williamson
2017-08-22 18:06                               ` Michael S. Tsirkin
2017-08-29 10:41                                 ` Bob Chen
2017-08-29 14:13                                   ` Alex Williamson
2017-08-30  9:41                                     ` Bob Chen
2017-08-30 16:43                                       ` Alex Williamson
2017-09-01  9:58                                         ` Bob Chen
2017-11-30  8:06                                           ` Bob Chen
2017-08-07 13:04                     ` Bob Chen
2017-08-07 16:00                       ` 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=20170726113222.52aad9a6@w520.home \
    --to=alex.williamson@redhat.com \
    --cc=chenbo02@meituan.com \
    --cc=marcel@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.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.