linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad@darnok.org>
To: Alexander Duyck <alexander.h.duyck@intel.com>
Cc: linux-mm@kvack.org, akpm@linux-foundation.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: Re: [mm PATCH v2 03/26] swiotlb: Add support for DMA_ATTR_SKIP_CPU_SYNC
Date: Sat, 5 Nov 2016 15:39:30 -0400	[thread overview]
Message-ID: <20161105193929.GA26349@localhost.localdomain> (raw)
In-Reply-To: <20161102111252.79519.21950.stgit@ahduyck-blue-test.jf.intel.com>

.. snip..
> @@ -561,6 +565,7 @@ void swiotlb_tbl_unmap_single(struct device *hwdev, phys_addr_t tlb_addr,
>  	 * First, sync the memory before unmapping the entry
>  	 */
>  	if (orig_addr != INVALID_PHYS_ADDR &&
> +	    !(attrs & DMA_ATTR_SKIP_CPU_SYNC) &&
>  	    ((dir == DMA_FROM_DEVICE) || (dir == DMA_BIDIRECTIONAL)))
>  		swiotlb_bounce(orig_addr, tlb_addr, size, DMA_FROM_DEVICE);
>  
> @@ -654,7 +659,8 @@ void swiotlb_tbl_sync_single(struct device *hwdev, phys_addr_t tlb_addr,
>  		 * GFP_DMA memory; fall back on map_single(), which
>  		 * will grab memory from the lowest available address range.
>  		 */
> -		phys_addr_t paddr = map_single(hwdev, 0, size, DMA_FROM_DEVICE);
> +		phys_addr_t paddr = map_single(hwdev, 0, size,
> +					       DMA_FROM_DEVICE, 0);
>  		if (paddr == SWIOTLB_MAP_ERROR)
>  			goto err_warn;
>  
> @@ -669,7 +675,8 @@ void swiotlb_tbl_sync_single(struct device *hwdev, phys_addr_t tlb_addr,
>  
>  			/* DMA_TO_DEVICE to avoid memcpy in unmap_single */
>  			swiotlb_tbl_unmap_single(hwdev, paddr,
> -						 size, DMA_TO_DEVICE);
> +						 size, DMA_TO_DEVICE,
> +						 DMA_ATTR_SKIP_CPU_SYNC);

This I believe is redundant. That is swiotlb_tbl_unmap_single only
does an bounce if the dir is DMA_FROM_DEVICE or DMA_BIDIRECTIONAL.

I added /* optional. */
>  			goto err_warn;
>  		}
>  	}
> @@ -699,7 +706,7 @@ void swiotlb_tbl_sync_single(struct device *hwdev, phys_addr_t tlb_addr,
>  		free_pages((unsigned long)vaddr, get_order(size));
>  	else
>  		/* DMA_TO_DEVICE to avoid memcpy in swiotlb_tbl_unmap_single */
> -		swiotlb_tbl_unmap_single(hwdev, paddr, size, DMA_TO_DEVICE);
> +		swiotlb_tbl_unmap_single(hwdev, paddr, size, DMA_TO_DEVICE, 0);

.. but here you choose to put 0? I changed that to
DMA_ATTR_SKIP_CPU_SYNC and expanded the comment above.

Time to test the patches.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2016-11-05 19:39 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-02 11:12 [mm PATCH v2 00/26] Add support for DMA writable pages being writable by the network stack Alexander Duyck
2016-11-02 11:12 ` [mm PATCH v2 01/26] swiotlb: Drop unused functions swiotlb_map_sg and swiotlb_unmap_sg Alexander Duyck
2016-11-03 14:14   ` Christoph Hellwig
2016-11-03 14:29     ` Konrad Rzeszutek Wilk
2016-11-03 14:45       ` Christoph Hellwig
2016-11-03 15:02         ` Duyck, Alexander H
2016-11-02 11:12 ` [mm PATCH v2 02/26] swiotlb-xen: Enforce return of DMA_ERROR_CODE in mapping function Alexander Duyck
2016-11-02 11:13 ` [mm PATCH v2 03/26] swiotlb: Add support for DMA_ATTR_SKIP_CPU_SYNC Alexander Duyck
2016-11-05 19:39   ` Konrad Rzeszutek Wilk [this message]
2016-11-05 23:13     ` Alexander Duyck
2016-11-02 11:13 ` [mm PATCH v2 04/26] arch/arc: Add option to skip sync on DMA mapping Alexander Duyck
2016-11-02 11:13 ` [mm PATCH v2 05/26] arch/arm: Add option to skip sync on DMA map and unmap Alexander Duyck
2016-11-02 11:13 ` [mm PATCH v2 06/26] arch/avr32: Add option to skip sync on DMA map Alexander Duyck
2016-11-02 11:13 ` [mm PATCH v2 07/26] arch/blackfin: " Alexander Duyck
2016-11-02 11:13 ` [mm PATCH v2 08/26] arch/c6x: Add option to skip sync on DMA map and unmap Alexander Duyck
2016-11-02 11:14 ` [mm PATCH v2 09/26] arch/frv: Add option to skip sync on DMA map Alexander Duyck
2016-11-02 11:14 ` [mm PATCH v2 10/26] arch/hexagon: Add option to skip DMA sync as a part of mapping Alexander Duyck
2016-11-02 11:14 ` [mm PATCH v2 11/26] arch/m68k: " Alexander Duyck
2016-11-02 11:14 ` [mm PATCH v2 12/26] arch/metag: Add option to skip DMA sync as a part of map and unmap Alexander Duyck
2016-11-02 11:14 ` [mm PATCH v2 13/26] arch/microblaze: " Alexander Duyck
2016-11-02 11:14 ` [mm PATCH v2 14/26] arch/mips: " Alexander Duyck
2016-11-02 11:14 ` [mm PATCH v2 15/26] arch/nios2: " Alexander Duyck
2016-11-02 11:14 ` [mm PATCH v2 16/26] arch/openrisc: Add option to skip DMA sync as a part of mapping Alexander Duyck
2016-11-02 11:15 ` [mm PATCH v2 17/26] arch/parisc: Add option to skip DMA sync as a part of map and unmap Alexander Duyck
2016-11-02 11:15 ` [mm PATCH v2 18/26] arch/powerpc: Add option to skip DMA sync as a part of mapping Alexander Duyck
2016-11-04  3:16   ` Michael Ellerman
2016-11-02 11:15 ` [mm PATCH v2 19/26] arch/sh: " Alexander Duyck
2016-11-02 11:15 ` [mm PATCH v2 20/26] arch/sparc: Add option to skip DMA sync as a part of map and unmap Alexander Duyck
2016-11-02 11:15 ` [mm PATCH v2 21/26] arch/tile: " Alexander Duyck
2016-11-02 11:15 ` [mm PATCH v2 22/26] arch/xtensa: Add option to skip DMA sync as a part of mapping Alexander Duyck
2016-11-02 11:16 ` [mm PATCH v2 23/26] dma: Add calls for dma_map_page_attrs and dma_unmap_page_attrs Alexander Duyck
2016-11-02 11:16 ` [mm PATCH v2 24/26] mm: Add support for releasing multiple instances of a page Alexander Duyck
2016-11-02 11:16 ` [mm PATCH v2 25/26] igb: Update driver to make use of DMA_ATTR_SKIP_CPU_SYNC Alexander Duyck
2016-11-02 11:16 ` [mm PATCH v2 26/26] igb: Update code to better handle incrementing page count Alexander Duyck

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=20161105193929.GA26349@localhost.localdomain \
    --to=konrad@darnok.org \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.h.duyck@intel.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=netdev@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox