From: Alexander Duyck <alexander.duyck@gmail.com>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-mips@linux-mips.org, linux-samsung-soc@vger.kernel.org,
linux-ia64@vger.kernel.org, linux-c6x-dev@linux-c6x.org,
linux-s390@vger.kernel.org, linux-sh@vger.kernel.org,
linux-hexagon@vger.kernel.org, linux-xtensa@linux-xtensa.org,
the arch/x86 maintainers <x86@kernel.org>,
linux-tegra@vger.kernel.org,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
dri-devel@lists.freedesktop.org, dmaengine@vger.kernel.org,
"open list:INTEL IOMMU (VT-d)" <iommu@lists.linux-foundation.org>,
openrisc@lists.librecores.org, Netdev <netdev@vger.kernel.org>,
sparclinux@vger.kernel.org, xen-devel@lists.xenproject.org,
linuxppc-dev@lists.ozlabs.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 03/44] dmaengine: ioat: don't use DMA_ERROR_CODE
Date: Fri, 16 Jun 2017 13:40:24 -0700 [thread overview]
Message-ID: <CAKgT0UdxrimWrxNVsLMQ9G6ABBJZwfWHTcP18qqd4rT0Fa-KWg__41922.7685699754$1497696114$gmane$org@mail.gmail.com> (raw)
In-Reply-To: <20170616181059.19206-4-hch@lst.de>
On Fri, Jun 16, 2017 at 11:10 AM, Christoph Hellwig <hch@lst.de> wrote:
> DMA_ERROR_CODE is not a public API and will go away. Instead properly
> unwind based on the loop counter.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Acked-by: Dave Jiang <dave.jiang@intel.com>
> Acked-By: Vinod Koul <vinod.koul@intel.com>
> ---
> drivers/dma/ioat/init.c | 24 +++++++-----------------
> 1 file changed, 7 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/dma/ioat/init.c b/drivers/dma/ioat/init.c
> index 6ad4384b3fa8..ed8ed1192775 100644
> --- a/drivers/dma/ioat/init.c
> +++ b/drivers/dma/ioat/init.c
> @@ -839,8 +839,6 @@ static int ioat_xor_val_self_test(struct ioatdma_device *ioat_dma)
> goto free_resources;
> }
>
> - for (i = 0; i < IOAT_NUM_SRC_TEST; i++)
> - dma_srcs[i] = DMA_ERROR_CODE;
> for (i = 0; i < IOAT_NUM_SRC_TEST; i++) {
> dma_srcs[i] = dma_map_page(dev, xor_srcs[i], 0, PAGE_SIZE,
> DMA_TO_DEVICE);
> @@ -910,8 +908,6 @@ static int ioat_xor_val_self_test(struct ioatdma_device *ioat_dma)
>
> xor_val_result = 1;
>
> - for (i = 0; i < IOAT_NUM_SRC_TEST + 1; i++)
> - dma_srcs[i] = DMA_ERROR_CODE;
> for (i = 0; i < IOAT_NUM_SRC_TEST + 1; i++) {
> dma_srcs[i] = dma_map_page(dev, xor_val_srcs[i], 0, PAGE_SIZE,
> DMA_TO_DEVICE);
> @@ -965,8 +961,6 @@ static int ioat_xor_val_self_test(struct ioatdma_device *ioat_dma)
> op = IOAT_OP_XOR_VAL;
>
> xor_val_result = 0;
> - for (i = 0; i < IOAT_NUM_SRC_TEST + 1; i++)
> - dma_srcs[i] = DMA_ERROR_CODE;
> for (i = 0; i < IOAT_NUM_SRC_TEST + 1; i++) {
> dma_srcs[i] = dma_map_page(dev, xor_val_srcs[i], 0, PAGE_SIZE,
> DMA_TO_DEVICE);
> @@ -1017,18 +1011,14 @@ static int ioat_xor_val_self_test(struct ioatdma_device *ioat_dma)
> goto free_resources;
> dma_unmap:
> if (op == IOAT_OP_XOR) {
> - if (dest_dma != DMA_ERROR_CODE)
> - dma_unmap_page(dev, dest_dma, PAGE_SIZE,
> - DMA_FROM_DEVICE);
> - for (i = 0; i < IOAT_NUM_SRC_TEST; i++)
> - if (dma_srcs[i] != DMA_ERROR_CODE)
> - dma_unmap_page(dev, dma_srcs[i], PAGE_SIZE,
> - DMA_TO_DEVICE);
> + while (--i >= 0)
> + dma_unmap_page(dev, dma_srcs[i], PAGE_SIZE,
> + DMA_TO_DEVICE);
> + dma_unmap_page(dev, dest_dma, PAGE_SIZE, DMA_FROM_DEVICE);
> } else if (op == IOAT_OP_XOR_VAL) {
> - for (i = 0; i < IOAT_NUM_SRC_TEST + 1; i++)
> - if (dma_srcs[i] != DMA_ERROR_CODE)
> - dma_unmap_page(dev, dma_srcs[i], PAGE_SIZE,
> - DMA_TO_DEVICE);
> + while (--i >= 0)
> + dma_unmap_page(dev, dma_srcs[i], PAGE_SIZE,
> + DMA_TO_DEVICE);
Wouldn't it make more sense to pull out the while loop and just call
dma_unmap_page on dest_dma if "op == IOAT_OP_XOR"? Odds are it is what
the compiler is already generating and will save a few lines of code
so what you end up with is something like:
while (--i >= 0)
dma_unmap_page(dev, dma_srcs[i], PAGE_SIZE, DMA_TO_DEVICE);
if (op == IOAT_OP_XOR)
dma_unmap_page(dev, dest_dma, PAGE_SIZE, DMA_FROM_DEVICE);
> }
> free_resources:
> dma->device_free_chan_resources(dma_chan);
> --
> 2.11.0
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-06-16 20:40 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20170616181059.19206-1-hch@lst.de>
2017-06-16 18:10 ` [PATCH 01/44] firmware/ivc: use dma_mapping_error Christoph Hellwig
2017-06-16 18:10 ` [PATCH 02/44] ibmveth: properly unwind on init errors Christoph Hellwig
2017-06-16 18:10 ` [PATCH 03/44] dmaengine: ioat: don't use DMA_ERROR_CODE Christoph Hellwig
2017-06-16 18:10 ` [PATCH 04/44] drm/exynos: " Christoph Hellwig
2017-06-16 18:10 ` [PATCH 05/44] drm/armada: don't abuse DMA_ERROR_CODE Christoph Hellwig
2017-06-16 18:10 ` [PATCH 06/44] iommu/dma: don't rely on DMA_ERROR_CODE Christoph Hellwig
2017-06-16 18:10 ` [PATCH 07/44] xen-swiotlb: consolidate xen_swiotlb_dma_ops Christoph Hellwig
2017-06-16 18:10 ` [PATCH 08/44] xen-swiotlb: implement ->mapping_error Christoph Hellwig
2017-06-16 18:10 ` [PATCH 09/44] c6x: remove DMA_ERROR_CODE Christoph Hellwig
2017-06-16 18:10 ` [PATCH 10/44] ia64: " Christoph Hellwig
2017-06-16 18:10 ` [PATCH 11/44] m32r: " Christoph Hellwig
2017-06-16 18:10 ` [PATCH 12/44] microblaze: " Christoph Hellwig
2017-06-16 18:10 ` [PATCH 13/44] openrisc: " Christoph Hellwig
2017-06-16 18:10 ` [PATCH 14/44] sh: " Christoph Hellwig
2017-06-16 18:10 ` [PATCH 15/44] xtensa: " Christoph Hellwig
2017-06-16 18:10 ` [PATCH 16/44] arm64: " Christoph Hellwig
2017-06-16 18:10 ` [PATCH 17/44] hexagon: switch to use ->mapping_error for error reporting Christoph Hellwig
2017-06-16 18:10 ` [PATCH 18/44] iommu/amd: implement ->mapping_error Christoph Hellwig
2017-06-16 18:10 ` [PATCH 19/44] s390: " Christoph Hellwig
2017-06-16 18:10 ` [PATCH 20/44] sparc: " Christoph Hellwig
2017-06-16 18:10 ` [PATCH 21/44] powerpc: " Christoph Hellwig
2017-06-16 18:10 ` [PATCH 22/44] x86/pci-nommu: " Christoph Hellwig
2017-06-16 18:10 ` [PATCH 23/44] x86/calgary: " Christoph Hellwig
2017-06-16 18:10 ` [PATCH 24/44] x86: remove DMA_ERROR_CODE Christoph Hellwig
2017-06-16 18:10 ` [PATCH 25/44] arm: implement ->mapping_error Christoph Hellwig
2017-06-16 18:10 ` [PATCH 26/44] dma-mapping: remove DMA_ERROR_CODE Christoph Hellwig
2017-06-16 18:10 ` [PATCH 27/44] sparc: remove leon_dma_ops Christoph Hellwig
2017-06-16 18:10 ` [PATCH 28/44] sparc: remove arch specific dma_supported implementations Christoph Hellwig
2017-06-16 18:10 ` [PATCH 29/44] dma-noop: remove dma_supported and mapping_error methods Christoph Hellwig
2017-06-16 18:10 ` [PATCH 30/44] dma-virt: " Christoph Hellwig
2017-06-16 18:10 ` [PATCH 31/44] hexagon: remove arch-specific dma_supported implementation Christoph Hellwig
2017-06-16 18:10 ` [PATCH 32/44] hexagon: remove the unused dma_is_consistent prototype Christoph Hellwig
2017-06-16 18:10 ` [PATCH 33/44] openrisc: remove arch-specific dma_supported implementation Christoph Hellwig
2017-06-16 18:10 ` [PATCH 34/44] arm: remove arch specific " Christoph Hellwig
2017-06-16 18:10 ` [PATCH 35/44] x86: " Christoph Hellwig
2017-06-16 18:10 ` [PATCH 36/44] dma-mapping: remove HAVE_ARCH_DMA_SUPPORTED Christoph Hellwig
2017-06-16 18:10 ` [PATCH 37/44] mips/loongson64: implement ->dma_supported instead of ->set_dma_mask Christoph Hellwig
2017-06-16 18:10 ` [PATCH 38/44] arm: " Christoph Hellwig
2017-06-16 18:10 ` [PATCH 39/44] xen-swiotlb: remove xen_swiotlb_set_dma_mask Christoph Hellwig
2017-06-16 18:10 ` [PATCH 40/44] tile: remove dma_supported and mapping_error methods Christoph Hellwig
2017-06-16 18:10 ` [PATCH 41/44] powerpc/cell: clean up fixed mapping dma_ops initialization Christoph Hellwig
2017-06-16 18:10 ` [PATCH 42/44] powerpc/cell: use the dma_supported method for ops switching Christoph Hellwig
2017-06-16 18:10 ` [PATCH 43/44] dma-mapping: remove the set_dma_mask method Christoph Hellwig
2017-06-16 18:10 ` [PATCH 44/44] powerpc: merge __dma_set_mask into dma_set_mask Christoph Hellwig
[not found] ` <20170616181059.19206-4-hch@lst.de>
2017-06-16 20:40 ` Alexander Duyck [this message]
[not found] ` <CAKgT0UdxrimWrxNVsLMQ9G6ABBJZwfWHTcP18qqd4rT0Fa-KWg@mail.gmail.com>
2017-06-18 7:09 ` [PATCH 03/44] dmaengine: ioat: don't use DMA_ERROR_CODE Christoph Hellwig
[not found] ` <20170616181059.19206-43-hch@lst.de>
2017-06-17 20:50 ` [PATCH 42/44] powerpc/cell: use the dma_supported method for ops switching Benjamin Herrenschmidt
[not found] ` <1497732627.2897.128.camel@kernel.crashing.org>
2017-06-18 7:13 ` Christoph Hellwig
[not found] ` <20170618071344.GB18526@infradead.org>
2017-06-18 9:54 ` Benjamin Herrenschmidt
[not found] ` <20170616181059.19206-7-hch@lst.de>
2017-06-19 15:12 ` [PATCH 06/44] iommu/dma: don't rely on DMA_ERROR_CODE Robin Murphy
2017-06-20 12:41 ` new dma-mapping tree, was Re: clean up and modularize arch dma_mapping interface V2 Christoph Hellwig
[not found] ` <20170620124140.GA27163@lst.de>
2017-06-20 13:04 ` Stephen Rothwell
2017-06-20 13:14 ` Robin Murphy
[not found] ` <6025d4d4-1975-9598-c16d-26d17d029ec7@arm.com>
2017-06-20 13:15 ` Christoph Hellwig
[not found] ` <20170620230400.1a5ae889@canb.auug.org.au>
2017-06-20 13:16 ` Christoph Hellwig
[not found] ` <CGME20170620131628epcas1p4f21d821bd414cba7e2d49abcbe414365@epcas1p4.samsung.com>
[not found] ` <20170620131623.GB30769@lst.de>
2017-06-21 13:32 ` Marek Szyprowski
[not found] ` <5425587c-73e8-e24a-86a3-8a65a7791dcb@samsung.com>
2017-06-22 21:53 ` Stephen Rothwell
2017-06-26 7:03 ` Christoph Hellwig
2017-06-21 19:24 ` tndave
[not found] ` <162d7932-5766-4c29-5471-07d1b699190a@oracle.com>
2017-06-24 7:18 ` Christoph Hellwig
[not found] ` <20170624071855.GD14580@lst.de>
2017-06-24 15:36 ` Benjamin Herrenschmidt
[not found] ` <1498318616.31581.87.camel@kernel.crashing.org>
2017-06-26 9:47 ` Christoph Hellwig
[not found] ` <20170626094739.GB13981@lst.de>
2017-06-26 22:06 ` tndave
[not found] <20170608132609.32662-1-hch@lst.de>
2017-06-08 13:25 ` [PATCH 03/44] dmaengine: ioat: don't use DMA_ERROR_CODE Christoph Hellwig
[not found] ` <20170608132609.32662-4-hch@lst.de>
2017-06-08 16:32 ` Dave Jiang
2017-06-14 8:31 ` Vinod Koul
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='CAKgT0UdxrimWrxNVsLMQ9G6ABBJZwfWHTcP18qqd4rT0Fa-KWg__41922.7685699754$1497696114$gmane$org@mail.gmail.com' \
--to=alexander.duyck@gmail.com \
--cc=dmaengine@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=hch@lst.de \
--cc=iommu@lists.linux-foundation.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-c6x-dev@linux-c6x.org \
--cc=linux-hexagon@vger.kernel.org \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=linux-xtensa@linux-xtensa.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=netdev@vger.kernel.org \
--cc=openrisc@lists.librecores.org \
--cc=sparclinux@vger.kernel.org \
--cc=x86@kernel.org \
--cc=xen-devel@lists.xenproject.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).