From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Alexander Duyck <alexander.h.duyck@intel.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, brouer@redhat.com, davem@davemloft.net
Subject: Re: [net-next PATCH RFC 02/26] swiotlb: Add support for DMA_ATTR_SKIP_CPU_SYNC
Date: Mon, 24 Oct 2016 14:09:34 -0400 [thread overview]
Message-ID: <20161024180934.GA24840@char.us.oracle.com> (raw)
In-Reply-To: <20161024120437.16276.68349.stgit@ahduyck-blue-test.jf.intel.com>
On Mon, Oct 24, 2016 at 08:04:37AM -0400, Alexander Duyck wrote:
> As a first step to making DMA_ATTR_SKIP_CPU_SYNC apply to architectures
> beyond just ARM I need to make it so that the swiotlb will respect the
> flag. In order to do that I also need to update the swiotlb-xen since it
> heavily makes use of the functionality.
>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
> ---
> drivers/xen/swiotlb-xen.c | 40 ++++++++++++++++++++++----------------
> include/linux/swiotlb.h | 6 ++++--
> lib/swiotlb.c | 48 +++++++++++++++++++++++++++------------------
> 3 files changed, 56 insertions(+), 38 deletions(-)
>
> diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c
> index 87e6035..cf047d8 100644
> --- a/drivers/xen/swiotlb-xen.c
> +++ b/drivers/xen/swiotlb-xen.c
> @@ -405,7 +405,8 @@ dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page,
> */
> trace_swiotlb_bounced(dev, dev_addr, size, swiotlb_force);
>
> - map = swiotlb_tbl_map_single(dev, start_dma_addr, phys, size, dir);
> + map = swiotlb_tbl_map_single(dev, start_dma_addr, phys, size, dir,
> + attrs);
> if (map == SWIOTLB_MAP_ERROR)
> return DMA_ERROR_CODE;
>
> @@ -416,11 +417,13 @@ dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page,
> /*
> * Ensure that the address returned is DMA'ble
> */
> - if (!dma_capable(dev, dev_addr, size)) {
> - swiotlb_tbl_unmap_single(dev, map, size, dir);
> - dev_addr = 0;
> - }
> - return dev_addr;
> + if (dma_capable(dev, dev_addr, size))
> + return dev_addr;
> +
> + swiotlb_tbl_unmap_single(dev, map, size, dir,
> + attrs | DMA_ATTR_SKIP_CPU_SYNC);
> +
> + return DMA_ERROR_CODE;
Why? This change (re-ordering the code - and returning DMA_ERROR_CODE instead
of 0) does not have anything to do with the title.
If you really feel strongly about it - then please send it as a seperate patch.
> }
> EXPORT_SYMBOL_GPL(xen_swiotlb_map_page);
>
> @@ -444,7 +447,7 @@ static void xen_unmap_single(struct device *hwdev, dma_addr_t dev_addr,
>
> /* NOTE: We use dev_addr here, not paddr! */
> if (is_xen_swiotlb_buffer(dev_addr)) {
> - swiotlb_tbl_unmap_single(hwdev, paddr, size, dir);
> + swiotlb_tbl_unmap_single(hwdev, paddr, size, dir, attrs);
> return;
> }
>
> @@ -557,16 +560,9 @@ void xen_swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr,
> start_dma_addr,
> sg_phys(sg),
> sg->length,
> - dir);
> - if (map == SWIOTLB_MAP_ERROR) {
> - dev_warn(hwdev, "swiotlb buffer is full\n");
> - /* Don't panic here, we expect map_sg users
> - to do proper error handling. */
> - xen_swiotlb_unmap_sg_attrs(hwdev, sgl, i, dir,
> - attrs);
> - sg_dma_len(sgl) = 0;
> - return 0;
> - }
> + dir, attrs);
> + if (map == SWIOTLB_MAP_ERROR)
> + goto map_error;
> xen_dma_map_page(hwdev, pfn_to_page(map >> PAGE_SHIFT),
> dev_addr,
> map & ~PAGE_MASK,
> @@ -589,6 +585,16 @@ void xen_swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr,
> sg_dma_len(sg) = sg->length;
> }
> return nelems;
> +map_error:
> + dev_warn(hwdev, "swiotlb buffer is full\n");
> + /*
> + * Don't panic here, we expect map_sg users
> + * to do proper error handling.
> + */
> + xen_swiotlb_unmap_sg_attrs(hwdev, sgl, i, dir,
> + attrs | DMA_ATTR_SKIP_CPU_SYNC);
> + sg_dma_len(sgl) = 0;
> + return 0;
> }
This too. Why can't that be part of the existing code that was there?
--
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>
next prev parent reply other threads:[~2016-10-24 18:09 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-24 12:04 [net-next PATCH RFC 00/26] Add support for DMA writable pages being writable by the network stack Alexander Duyck
2016-10-24 12:04 ` [net-next PATCH RFC 01/26] swiotlb: Drop unused function swiotlb_map_sg Alexander Duyck
2016-10-24 18:10 ` Konrad Rzeszutek Wilk
2016-10-24 12:04 ` [net-next PATCH RFC 02/26] swiotlb: Add support for DMA_ATTR_SKIP_CPU_SYNC Alexander Duyck
2016-10-24 18:09 ` Konrad Rzeszutek Wilk [this message]
2016-10-24 19:16 ` Alexander Duyck
2016-10-25 1:22 ` Konrad Rzeszutek Wilk
2016-10-24 12:04 ` [net-next PATCH RFC 03/26] arch/arc: Add option to skip sync on DMA mapping Alexander Duyck
2016-10-24 12:04 ` [net-next PATCH RFC 04/26] arch/arm: Add option to skip sync on DMA map and unmap Alexander Duyck
2016-10-31 10:20 ` Russell King - ARM Linux
2016-10-31 15:26 ` Alexander Duyck
2016-10-24 12:04 ` [net-next PATCH RFC 05/26] arch/avr32: Add option to skip sync on DMA map Alexander Duyck
2016-10-24 18:27 ` Hans-Christian Noren Egtvedt
2016-10-24 12:04 ` [net-next PATCH RFC 06/26] arch/blackfin: " Alexander Duyck
2016-10-24 12:05 ` [net-next PATCH RFC 07/26] arch/c6x: Add option to skip sync on DMA map and unmap Alexander Duyck
2016-10-28 14:59 ` Mark Salter
2016-10-24 12:05 ` [net-next PATCH RFC 08/26] arch/frv: Add option to skip sync on DMA map Alexander Duyck
2016-10-24 12:05 ` [net-next PATCH RFC 09/26] arch/hexagon: Add option to skip DMA sync as a part of mapping Alexander Duyck
2016-10-24 12:05 ` [net-next PATCH RFC 10/26] arch/m68k: " Alexander Duyck
2016-10-24 12:05 ` [net-next PATCH RFC 11/26] arch/metag: Add option to skip DMA sync as a part of map and unmap Alexander Duyck
2016-10-24 12:05 ` [net-next PATCH RFC 12/26] arch/microblaze: " Alexander Duyck
2016-10-24 12:05 ` [net-next PATCH RFC 13/26] arch/mips: " Alexander Duyck
2016-10-24 12:05 ` [net-next PATCH RFC 14/26] arch/nios2: " Alexander Duyck
2016-10-24 12:05 ` [net-next PATCH RFC 15/26] arch/openrisc: Add option to skip DMA sync as a part of mapping Alexander Duyck
2016-10-24 12:05 ` [net-next PATCH RFC 16/26] arch/parisc: Add option to skip DMA sync as a part of map and unmap Alexander Duyck
2016-10-24 12:05 ` [net-next PATCH RFC 17/26] arch/powerpc: Add option to skip DMA sync as a part of mapping Alexander Duyck
2016-10-24 12:06 ` [net-next PATCH RFC 18/26] arch/sh: " Alexander Duyck
2016-10-24 12:06 ` [net-next PATCH RFC 19/26] arch/sparc: Add option to skip DMA sync as a part of map and unmap Alexander Duyck
2016-10-24 18:27 ` David Miller
2016-10-24 19:24 ` Alexander Duyck
2016-10-24 12:06 ` [net-next PATCH RFC 20/26] arch/tile: " Alexander Duyck
2016-10-24 12:06 ` [net-next PATCH RFC 21/26] arch/xtensa: Add option to skip DMA sync as a part of mapping Alexander Duyck
2016-10-24 12:06 ` [net-next PATCH RFC 22/26] dma: Add calls for dma_map_page_attrs and dma_unmap_page_attrs Alexander Duyck
2016-10-24 12:06 ` [net-next PATCH RFC 23/26] mm: Add support for releasing multiple instances of a page Alexander Duyck
2016-10-24 12:06 ` [net-next PATCH RFC 24/26] igb: Update driver to make use of DMA_ATTR_SKIP_CPU_SYNC Alexander Duyck
2016-10-24 12:06 ` [net-next PATCH RFC 25/26] igb: Update code to better handle incrementing page count Alexander Duyck
2016-10-24 12:06 ` [net-next PATCH RFC 26/26] igb: Revert "igb: Revert support for build_skb in igb" 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=20161024180934.GA24840@char.us.oracle.com \
--to=konrad.wilk@oracle.com \
--cc=alexander.h.duyck@intel.com \
--cc=brouer@redhat.com \
--cc=davem@davemloft.net \
--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;
as well as URLs for NNTP newsgroup(s).