Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-10-06 Thread Christian Borntraeger
Am 29.09.2014 20:55, schrieb Andy Lutomirski: On Wed, Sep 17, 2014 at 7:16 AM, Michael S. Tsirkin m...@redhat.com wrote: On Wed, Sep 17, 2014 at 08:02:31AM -0400, Benjamin Herrenschmidt wrote: On Tue, 2014-09-16 at 22:22 -0700, Andy Lutomirski wrote: On non-PPC systems, virtio_pci should use

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-10-06 Thread Benjamin Herrenschmidt
On Mon, 2014-10-06 at 11:59 +0200, Christian Borntraeger wrote: Just as a comment: On s390 we always considered the memory access as access to real memory (not device memory) for virtio accesses. I prefer to not touch the DMA API on s390 as it is quite s390-PCI specific but it is somewhat

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-10-02 Thread Konrad Rzeszutek Wilk
On Tue, Sep 30, 2014 at 11:01:29AM -0700, Andy Lutomirski wrote: On Tue, Sep 30, 2014 at 10:53 AM, Konrad Rzeszutek Wilk konrad.w...@oracle.com wrote: x86 will be worse than PPC, too: the special case needed to support QEMU 2.2 with IOMMU and virtio enabled with a Xen guest will be fairly

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-10-01 Thread Michael S. Tsirkin
On Tue, Sep 30, 2014 at 08:48:45AM -0700, Andy Lutomirski wrote: On Tue, Sep 30, 2014 at 8:38 AM, Michael S. Tsirkin m...@redhat.com wrote: I thought hard about this, I think we are better off waiting till the next release: there's a chance QEMU will have IOMMU support for KVM x86 then, and

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-10-01 Thread Michael S. Tsirkin
On Tue, Sep 30, 2014 at 05:53:37PM +0200, Paolo Bonzini wrote: Il 30/09/2014 17:38, Michael S. Tsirkin ha scritto: I think that is true but it seems that this will be true for x86 for QEMU 2.2 unless we make some changes there. Which we might not have the time for since 2.2 is feature

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-30 Thread Michael S. Tsirkin
On Mon, Sep 29, 2014 at 01:55:11PM -0700, Andy Lutomirski wrote: On Mon, Sep 29, 2014 at 1:49 PM, Benjamin Herrenschmidt b...@kernel.crashing.org wrote: On Mon, 2014-09-29 at 11:55 -0700, Andy Lutomirski wrote: Rusty and Michael, what's the status of this? The status is that I still

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-30 Thread Andy Lutomirski
On Tue, Sep 30, 2014 at 8:38 AM, Michael S. Tsirkin m...@redhat.com wrote: I thought hard about this, I think we are better off waiting till the next release: there's a chance QEMU will have IOMMU support for KVM x86 then, and this will make it easier to judge which way does the wind blow.

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-30 Thread Paolo Bonzini
Il 30/09/2014 17:38, Michael S. Tsirkin ha scritto: I think that is true but it seems that this will be true for x86 for QEMU 2.2 unless we make some changes there. Which we might not have the time for since 2.2 is feature frozen from tomorrow. Maybe we should disable the IOMMU in 2.2, this

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-30 Thread Andy Lutomirski
On Tue, Sep 30, 2014 at 8:48 AM, Andy Lutomirski l...@amacapital.net wrote: On Tue, Sep 30, 2014 at 8:38 AM, Michael S. Tsirkin m...@redhat.com wrote: Maybe we should disable the IOMMU in 2.2, this is worth considering. Please do. Also, try booting this 2.2 QEMU candidate with nested

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-30 Thread Konrad Rzeszutek Wilk
x86 will be worse than PPC, too: the special case needed to support QEMU 2.2 with IOMMU and virtio enabled with a Xen guest will be fairly large and disgusting and will only exist to support something that IMO should never have existed in the first place. scratches his head I don't follow.

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-30 Thread Andy Lutomirski
On Tue, Sep 30, 2014 at 10:53 AM, Konrad Rzeszutek Wilk konrad.w...@oracle.com wrote: x86 will be worse than PPC, too: the special case needed to support QEMU 2.2 with IOMMU and virtio enabled with a Xen guest will be fairly large and disgusting and will only exist to support something that IMO

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-30 Thread Andy Lutomirski
On Tue, Sep 30, 2014 at 8:38 AM, Michael S. Tsirkin m...@redhat.com wrote: On Mon, Sep 29, 2014 at 01:55:11PM -0700, Andy Lutomirski wrote: On Mon, Sep 29, 2014 at 1:49 PM, Benjamin Herrenschmidt b...@kernel.crashing.org wrote: On Mon, 2014-09-29 at 11:55 -0700, Andy Lutomirski wrote:

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-29 Thread Andy Lutomirski
On Wed, Sep 17, 2014 at 7:16 AM, Michael S. Tsirkin m...@redhat.com wrote: On Wed, Sep 17, 2014 at 08:02:31AM -0400, Benjamin Herrenschmidt wrote: On Tue, 2014-09-16 at 22:22 -0700, Andy Lutomirski wrote: On non-PPC systems, virtio_pci should use the DMA API. This fixes virtio_pci on Xen.

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-29 Thread Benjamin Herrenschmidt
On Mon, 2014-09-29 at 11:55 -0700, Andy Lutomirski wrote: Rusty and Michael, what's the status of this? The status is that I still think we need *a* way to actually inform the guest whether the virtio implementation will or will not bypass the IOMMU. I don't know Xen enough to figure out how to

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-29 Thread Andy Lutomirski
On Mon, Sep 29, 2014 at 1:49 PM, Benjamin Herrenschmidt b...@kernel.crashing.org wrote: On Mon, 2014-09-29 at 11:55 -0700, Andy Lutomirski wrote: Rusty and Michael, what's the status of this? The status is that I still think we need *a* way to actually inform the guest whether the virtio

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-29 Thread Benjamin Herrenschmidt
On Mon, 2014-09-29 at 13:55 -0700, Andy Lutomirski wrote: If the eventual solution is to say that virtio 1.0 PCI devices always respect an IOMMU unless they set a magic flag saying I'm not real hardware and I bypass the IOMMU, then I don't really object to that, except that it'll be a mess if

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-24 Thread Andy Lutomirski
On Sat, Sep 20, 2014 at 10:05 PM, Benjamin Herrenschmidt b...@kernel.crashing.org wrote: On Sun, 2014-09-21 at 15:03 +1000, Benjamin Herrenschmidt wrote: The exception I mentioned is that I would really like the virtio device to expose via whatever transport we chose to use (though capability

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-24 Thread Benjamin Herrenschmidt
On Wed, 2014-09-24 at 14:41 -0700, Andy Lutomirski wrote: On Sat, Sep 20, 2014 at 10:05 PM, Benjamin Herrenschmidt b...@kernel.crashing.org wrote: On Sun, 2014-09-21 at 15:03 +1000, Benjamin Herrenschmidt wrote: The exception I mentioned is that I would really like the virtio device to

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-24 Thread Andy Lutomirski
On Wed, Sep 24, 2014 at 2:50 PM, Benjamin Herrenschmidt b...@kernel.crashing.org wrote: On Wed, 2014-09-24 at 14:41 -0700, Andy Lutomirski wrote: On Sat, Sep 20, 2014 at 10:05 PM, Benjamin Herrenschmidt b...@kernel.crashing.org wrote: On Sun, 2014-09-21 at 15:03 +1000, Benjamin Herrenschmidt

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-24 Thread Benjamin Herrenschmidt
On Wed, 2014-09-24 at 14:59 -0700, Andy Lutomirski wrote: Scratch that idea, then. The best that I can currently come up with is to say that pre-1.0 devices on PPC bypass the IOMMU and that 1.0 devices on PPC and all devices on all other architectures do not bypass the IOMMU. Well, the

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-24 Thread Andy Lutomirski
On Wed, Sep 24, 2014 at 3:04 PM, Benjamin Herrenschmidt b...@kernel.crashing.org wrote: On Wed, 2014-09-24 at 14:59 -0700, Andy Lutomirski wrote: Scratch that idea, then. The best that I can currently come up with is to say that pre-1.0 devices on PPC bypass the IOMMU and that 1.0 devices on

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-24 Thread Benjamin Herrenschmidt
On Wed, 2014-09-24 at 15:15 -0700, Andy Lutomirski wrote: On Wed, Sep 24, 2014 at 3:04 PM, Benjamin Herrenschmidt b...@kernel.crashing.org wrote: On Wed, 2014-09-24 at 14:59 -0700, Andy Lutomirski wrote: Scratch that idea, then. The best that I can currently come up with is to say that

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-21 Thread David Woodhouse
On Sat, 2014-09-20 at 22:48 -0700, Andy Lutomirski wrote: I'm all for doing this as some kind of bus property, if needed, although David Woodhouse may be right that the best solution is to *always* have the IOMMU there and to just ask it for an identity map if desired. That's the right

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-20 Thread Andy Lutomirski
On Sep 19, 2014 2:33 PM, Benjamin Herrenschmidt b...@kernel.crashing.org wrote: On Wed, 2014-09-17 at 09:07 -0700, Andy Lutomirski wrote: It shouldn't. That being said, at some point this problem will need solving on PPC, and this patch doesn't help much, other than adding the virtio_ring

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-20 Thread Benjamin Herrenschmidt
On Fri, 2014-09-19 at 22:59 -0700, Andy Lutomirski wrote: Sure. The question is: should the patches go in to 3.18 as is our should they wait? It would be straightforward to remove the use_dma_api switch PPC, s390, and virtio_mmio are ready. I don't mind the patches going in now in their

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-20 Thread Benjamin Herrenschmidt
On Sun, 2014-09-21 at 15:03 +1000, Benjamin Herrenschmidt wrote: The exception I mentioned is that I would really like the virtio device to expose via whatever transport we chose to use (though capability exchange sounds like a reasonable one) whether the server implementation is bypassing

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-20 Thread Andy Lutomirski
On Sat, Sep 20, 2014 at 10:05 PM, Benjamin Herrenschmidt b...@kernel.crashing.org wrote: On Sun, 2014-09-21 at 15:03 +1000, Benjamin Herrenschmidt wrote: The exception I mentioned is that I would really like the virtio device to expose via whatever transport we chose to use (though capability

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-19 Thread Benjamin Herrenschmidt
On Wed, 2014-09-17 at 09:49 -0700, David Woodhouse wrote: On Wed, 2014-09-17 at 09:07 -0700, Andy Lutomirski wrote: I still think that this is a property of the bus, not the device. x86 has such a mechanism, and this patch uses it transparently. Right. A device driver should use the

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-19 Thread Benjamin Herrenschmidt
On Wed, 2014-09-17 at 17:16 +0300, Michael S. Tsirkin wrote: On Wed, Sep 17, 2014 at 08:02:31AM -0400, Benjamin Herrenschmidt wrote: On Tue, 2014-09-16 at 22:22 -0700, Andy Lutomirski wrote: On non-PPC systems, virtio_pci should use the DMA API. This fixes virtio_pci on Xen. On PPC,

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-19 Thread Benjamin Herrenschmidt
On Wed, 2014-09-17 at 09:07 -0700, Andy Lutomirski wrote: It shouldn't. That being said, at some point this problem will need solving on PPC, and this patch doesn't help much, other than adding the virtio_ring piece. I'd really like to see the generic or arch IOMMU code handle this so that

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-17 Thread Benjamin Herrenschmidt
On Tue, 2014-09-16 at 22:22 -0700, Andy Lutomirski wrote: On non-PPC systems, virtio_pci should use the DMA API. This fixes virtio_pci on Xen. On PPC, using the DMA API would break things, so we need to preserve the old behavior. The big comment in this patch explains the considerations in

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-17 Thread Michael S. Tsirkin
On Wed, Sep 17, 2014 at 08:02:31AM -0400, Benjamin Herrenschmidt wrote: On Tue, 2014-09-16 at 22:22 -0700, Andy Lutomirski wrote: On non-PPC systems, virtio_pci should use the DMA API. This fixes virtio_pci on Xen. On PPC, using the DMA API would break things, so we need to preserve the

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-17 Thread Andy Lutomirski
On Sep 17, 2014 7:13 AM, Michael S. Tsirkin m...@redhat.com wrote: On Wed, Sep 17, 2014 at 08:02:31AM -0400, Benjamin Herrenschmidt wrote: On Tue, 2014-09-16 at 22:22 -0700, Andy Lutomirski wrote: On non-PPC systems, virtio_pci should use the DMA API. This fixes virtio_pci on Xen. On

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-17 Thread Ira W. Snyder
On Tue, Sep 16, 2014 at 10:22:27PM -0700, Andy Lutomirski wrote: On non-PPC systems, virtio_pci should use the DMA API. This fixes virtio_pci on Xen. On PPC, using the DMA API would break things, so we need to preserve the old behavior. The big comment in this patch explains the

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-17 Thread Andy Lutomirski
On Wed, Sep 17, 2014 at 9:09 AM, Ira W. Snyder i...@ovro.caltech.edu wrote: On Tue, Sep 16, 2014 at 10:22:27PM -0700, Andy Lutomirski wrote: On non-PPC systems, virtio_pci should use the DMA API. This fixes virtio_pci on Xen. On PPC, using the DMA API would break things, so we need to

Re: [PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-17 Thread David Woodhouse
On Wed, 2014-09-17 at 09:07 -0700, Andy Lutomirski wrote: I still think that this is a property of the bus, not the device. x86 has such a mechanism, and this patch uses it transparently. Right. A device driver should use the DMA API. Always. The platform's implementation of the DMA API is

[PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible

2014-09-16 Thread Andy Lutomirski
On non-PPC systems, virtio_pci should use the DMA API. This fixes virtio_pci on Xen. On PPC, using the DMA API would break things, so we need to preserve the old behavior. The big comment in this patch explains the considerations in more detail. Signed-off-by: Andy Lutomirski