Re: [RFC 0/4] Virtio uses DMA API for all devices

2018-08-06 Thread Anshuman Khandual
On 08/05/2018 05:54 AM, Michael S. Tsirkin wrote: > On Fri, Aug 03, 2018 at 08:21:26PM -0500, Benjamin Herrenschmidt wrote: >> On Fri, 2018-08-03 at 22:08 +0300, Michael S. Tsirkin wrote: >> Please go through these patches and review whether this approach broadly >> makes sense. I will appr

Re: [RFC 2/4] virtio: Override device's DMA OPS with virtio_direct_dma_ops selectively

2018-07-31 Thread Anshuman Khandual
On 07/30/2018 02:55 PM, Christoph Hellwig wrote: >> +const struct dma_map_ops virtio_direct_dma_ops; > > This belongs into a header if it is non-static. If you only > use it in this file anyway please mark it static and avoid a forward > declaration. Sure, will make it static, move the definitio

Re: [RFC 2/4] virtio: Override device's DMA OPS with virtio_direct_dma_ops selectively

2018-07-30 Thread Anshuman Khandual
On 07/30/2018 03:00 PM, Christoph Hellwig wrote: >>> + >>> + if (xen_domain()) >>> + goto skip_override; >>> + >>> + if (virtio_has_iommu_quirk(dev)) >>> + set_dma_ops(dev->dev.parent, &virtio_direct_dma_ops); >>> + >>> + skip_override: >>> + >> >> I prefer normal if scoping

Re: [RFC 1/4] virtio: Define virtio_direct_dma_ops structure

2018-07-30 Thread Anshuman Khandual
On 07/30/2018 02:54 PM, Christoph Hellwig wrote: >> +/* >> + * Virtio direct mapping DMA API operations structure >> + * >> + * This defines DMA API structure for all virtio devices which would not >> + * either bring in their own DMA OPS from architecture or they would not >> + * like to use archi

Re: [RFC 2/4] virtio: Override device's DMA OPS with virtio_direct_dma_ops selectively

2018-07-29 Thread Anshuman Khandual
On 07/29/2018 02:46 AM, Michael S. Tsirkin wrote: > On Sat, Jul 28, 2018 at 02:26:24PM +0530, Anshuman Khandual wrote: >> On 07/20/2018 09:29 AM, Anshuman Khandual wrote: >>> Now that virtio core always needs all virtio devices to have DMA OPS, we >>> need to make sure t

Re: [RFC 2/4] virtio: Override device's DMA OPS with virtio_direct_dma_ops selectively

2018-07-28 Thread Anshuman Khandual
On 07/20/2018 09:29 AM, Anshuman Khandual wrote: > Now that virtio core always needs all virtio devices to have DMA OPS, we > need to make sure that the structure it points is the right one. In the > absence of VIRTIO_F_IOMMU_PLATFORM flag QEMU expects GPA from guest kernel. > In such

Re: [RFC 0/4] Virtio uses DMA API for all devices

2018-07-28 Thread Anshuman Khandual
On 07/27/2018 05:01 PM, Michael S. Tsirkin wrote: > On Wed, Jul 25, 2018 at 08:56:23AM +0530, Anshuman Khandual wrote: >> Results with and without the patches are similar. > > Thanks! And another thing to try is virtio-net with > a fast NIC backend (40G and up). Unfortunate

Re: [RFC 0/4] Virtio uses DMA API for all devices

2018-07-27 Thread Anshuman Khandual
On 07/27/2018 03:28 PM, Will Deacon wrote: > Hi Anshuman, > > On Fri, Jul 20, 2018 at 09:29:37AM +0530, Anshuman Khandual wrote: >> This patch series is the follow up on the discussions we had before about >> the RFC titled [RFC,V2] virtio: Add platform specific DMA API tran

Re: [RFC 4/4] virtio: Add platform specific DMA API translation for virito devices

2018-07-24 Thread Anshuman Khandual
On 07/23/2018 07:46 AM, Anshuman Khandual wrote: > On 07/20/2018 06:45 PM, Michael S. Tsirkin wrote: >> On Fri, Jul 20, 2018 at 09:29:41AM +0530, Anshuman Khandual wrote: >>> Subject: Re: [RFC 4/4] virtio: Add platform specific DMA API translation for >>> virito de

Re: [RFC 0/4] Virtio uses DMA API for all devices

2018-07-24 Thread Anshuman Khandual
On 07/23/2018 02:38 PM, Michael S. Tsirkin wrote: > On Mon, Jul 23, 2018 at 11:58:23AM +0530, Anshuman Khandual wrote: >> On 07/20/2018 06:46 PM, Michael S. Tsirkin wrote: >>> On Fri, Jul 20, 2018 at 09:29:37AM +0530, Anshuman Khandual wrote: >>>> This patch

Re: [RFC 0/4] Virtio uses DMA API for all devices

2018-07-22 Thread Anshuman Khandual
On 07/20/2018 06:46 PM, Michael S. Tsirkin wrote: > On Fri, Jul 20, 2018 at 09:29:37AM +0530, Anshuman Khandual wrote: >> This patch series is the follow up on the discussions we had before about >> the RFC titled [RFC,V2] virtio: Add platform specific DMA API translation >&g

Re: [RFC 4/4] virtio: Add platform specific DMA API translation for virito devices

2018-07-22 Thread Anshuman Khandual
On 07/20/2018 06:45 PM, Michael S. Tsirkin wrote: > On Fri, Jul 20, 2018 at 09:29:41AM +0530, Anshuman Khandual wrote: >> Subject: Re: [RFC 4/4] virtio: Add platform specific DMA API translation for >> virito devices > > s/virito/virtio/ Oops, will fix it. Thanks for poin

[RFC 4/4] virtio: Add platform specific DMA API translation for virito devices

2018-07-19 Thread Anshuman Khandual
code in the secure guest can force the use of swiotlb for virtio buffers, with a back-end for swiotlb which will use a pool of pre-allocated shared pages. Thus all data being sent or received by virtio devices will be copied through pages which the host has access to. Signed-off-by: Anshuman Kha

[RFC 3/4] virtio: Force virtio core to use DMA API callbacks for all virtio devices

2018-07-19 Thread Anshuman Khandual
. Signed-off-by: Anshuman Khandual --- drivers/virtio/virtio_ring.c | 65 ++-- 1 file changed, 2 insertions(+), 63 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 814b395..c265964 100644 --- a/drivers/virtio

[RFC 2/4] virtio: Override device's DMA OPS with virtio_direct_dma_ops selectively

2018-07-19 Thread Anshuman Khandual
g and does the override in case the flag is cleared. Signed-off-by: Anshuman Khandual --- drivers/virtio/virtio.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index 7907ad3..6b13987 100644 --- a/drivers/virtio/virtio.c +++ b/driv

[RFC 1/4] virtio: Define virtio_direct_dma_ops structure

2018-07-19 Thread Anshuman Khandual
g DMA OPS structure to be used in later patches which will make virtio core call DMA API all the time for all virtio devices. Signed-off-by: Anshuman Khandual --- drivers/virtio/virtio.c| 60 ++ drivers/virtio/virtio_pci_common.h | 3 ++ 2 files ch

[RFC 0/4] Virtio uses DMA API for all devices

2018-07-19 Thread Anshuman Khandual
hared memory for all I/O scatter gather buffers to be consumed on the host side. Please go through these patches and review whether this approach broadly makes sense. I will appreciate suggestions, inputs, comments regarding the patches or the approach in general. Thank you. Anshuman Khandual (

Re: [RFC V2] virtio: Add platform specific DMA API translation for virito devices

2018-05-30 Thread Anshuman Khandual
On 05/24/2018 12:51 PM, Ram Pai wrote: > On Wed, May 23, 2018 at 09:50:02PM +0300, Michael S. Tsirkin wrote: >> subj: s/virito/virtio/ >> > ..snip.. >>> machine_subsys_initcall_sync(pseries, tce_iommu_bus_notifier_init); >>> + >>> +bool platform_forces_virtio_dma(struct virtio_device *vdev) >>> +{

[RFC V2] virtio: Add platform specific DMA API translation for virito devices

2018-05-21 Thread Anshuman Khandual
, the platform code in the secure guest can force the use of swiotlb for virtio buffers, with a back-end for swiotlb which will use a pool of pre-allocated shared pages. Thus all data being sent or received by virtio devices will be copied through pages which the host has access to. Signed-off-by: Ans

Re: [RFC] virtio: Use DMA MAP API for devices without an IOMMU

2018-04-17 Thread Anshuman Khandual
On 04/15/2018 05:41 PM, Christoph Hellwig wrote: > On Fri, Apr 06, 2018 at 06:37:18PM +1000, Benjamin Herrenschmidt wrote: implemented as DMA API which the virtio core understands. There is no need for an IOMMU to be involved for the device representation in this case IMHO. >>> >>> T

Re: [RFC] virtio: Use DMA MAP API for devices without an IOMMU

2018-04-05 Thread Anshuman Khandual
On 04/06/2018 02:48 AM, Benjamin Herrenschmidt wrote: > On Thu, 2018-04-05 at 21:34 +0300, Michael S. Tsirkin wrote: >>> In this specific case, because that would make qemu expect an iommu, >>> and there isn't one. >> >> >> I think that you can set iommu_platform in qemu without an iommu. > > No I

Re: [RFC] virtio: Use DMA MAP API for devices without an IOMMU

2018-04-05 Thread Anshuman Khandual
On 04/05/2018 04:26 PM, Anshuman Khandual wrote: > There are certian platforms which would like to use SWIOTLB based DMA API > for bouncing purpose without actually requiring an IOMMU back end. But the > virtio core does not allow such mechanism. Right now DMA MAP API is only >

Re: [RFC] virtio: Use DMA MAP API for devices without an IOMMU

2018-04-05 Thread Anshuman Khandual
On 04/05/2018 04:44 PM, Balbir Singh wrote: > On Thu, Apr 5, 2018 at 8:56 PM, Anshuman Khandual > wrote: >> There are certian platforms which would like to use SWIOTLB based DMA API >> for bouncing purpose without actually requiring an IOMMU back end. But the >> virtio

[RFC] virtio: Use DMA MAP API for devices without an IOMMU

2018-04-05 Thread Anshuman Khandual
structure. Signed-off-by: Anshuman Khandual --- This RFC is just to get some feedback. Please ignore the function call back into the architecture. It can be worked out properly later on. But the question is can we have virtio devices in the guest which would like to use SWIOTLB based (or any custom DMA

Re: [PATCH v6v3 02/12] mm: migrate: support non-lru movable page migration

2016-06-29 Thread Anshuman Khandual
On 06/28/2016 12:09 PM, Minchan Kim wrote: > On Mon, Jun 27, 2016 at 11:21:01AM +0530, Anshuman Khandual wrote: >> On 06/16/2016 11:07 AM, Minchan Kim wrote: >>> On Thu, Jun 16, 2016 at 09:12:07AM +0530, Anshuman Khandual wrote: >>>> On 06/16/2016 05:56 AM, Minchan K

Re: [PATCH v6v3 02/12] mm: migrate: support non-lru movable page migration

2016-06-26 Thread Anshuman Khandual
On 06/16/2016 11:07 AM, Minchan Kim wrote: > On Thu, Jun 16, 2016 at 09:12:07AM +0530, Anshuman Khandual wrote: >> On 06/16/2016 05:56 AM, Minchan Kim wrote: >>> On Wed, Jun 15, 2016 at 12:15:04PM +0530, Anshuman Khandual wrote: >>>> On 06/15/2016 08:02 A

Re: [PATCH v6v3 02/12] mm: migrate: support non-lru movable page migration

2016-06-15 Thread Anshuman Khandual
On 06/16/2016 05:56 AM, Minchan Kim wrote: > On Wed, Jun 15, 2016 at 12:15:04PM +0530, Anshuman Khandual wrote: >> On 06/15/2016 08:02 AM, Minchan Kim wrote: >>> Hi, >>> >>> On Mon, Jun 13, 2016 at 03:08:19PM +0530, Anshuman Khandual wrote: >>>

Re: [PATCH v6v3 02/12] mm: migrate: support non-lru movable page migration

2016-06-14 Thread Anshuman Khandual
On 06/15/2016 08:02 AM, Minchan Kim wrote: > Hi, > > On Mon, Jun 13, 2016 at 03:08:19PM +0530, Anshuman Khandual wrote: >> > On 05/31/2016 05:31 AM, Minchan Kim wrote: >>> > > @@ -791,6 +921,7 @@ static int __unmap_and_move(struct page *page, >>> > &

Re: [PATCH v6v3 02/12] mm: migrate: support non-lru movable page migration

2016-06-13 Thread Anshuman Khandual
On 05/31/2016 05:31 AM, Minchan Kim wrote: > @@ -791,6 +921,7 @@ static int __unmap_and_move(struct page *page, struct > page *newpage, > int rc = -EAGAIN; > int page_was_mapped = 0; > struct anon_vma *anon_vma = NULL; > + bool is_lru = !__PageMovable(page); > > if (!