dmaengine Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] dmaengine: ioat: Allocate correct size for descriptor chunk
@ 2020-09-22 20:08 Logan Gunthorpe
  2020-09-22 20:18 ` Dave Jiang
  2020-10-05  4:46 ` Vinod Koul
  0 siblings, 2 replies; 3+ messages in thread
From: Logan Gunthorpe @ 2020-09-22 20:08 UTC (permalink / raw)
  To: dmaengine, linux-kernel
  Cc: Logan Gunthorpe, Robin Murphy, Vinod Koul, Dave Jiang, Dan Williams

dma_alloc_coherent() is called with a fixed SZ_2M size, but frees happen
with IOAT_CHUNK_SIZE. Recently, IOAT_CHUNK_SIZE was reduced to 512M but
the allocation did not change. To fix, change to using the
IOAT_CHUNK_SIZE define.

This was caught with the upcoming patchset for converting Intel platforms to the
dma-iommu implementation. It has a warning when the unmapped size differs from
the mapped size.

Fixes: a02254f8a676 ("dmaengine: ioat: Decreasing allocation chunk size 2M->512K")
Link: https://lore.kernel.org/intel-gfx/776771a2-247a-d1be-d882-bee02d919ae0@deltatee.com/
Suggested-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Cc: Vinod Koul <vkoul@kernel.org>
Cc: Dave Jiang <dave.jiang@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
---
 drivers/dma/ioat/dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c
index a814b200299b..07296171e2bb 100644
--- a/drivers/dma/ioat/dma.c
+++ b/drivers/dma/ioat/dma.c
@@ -389,7 +389,7 @@ ioat_alloc_ring(struct dma_chan *c, int order, gfp_t flags)
 		struct ioat_descs *descs = &ioat_chan->descs[i];
 
 		descs->virt = dma_alloc_coherent(to_dev(ioat_chan),
-						 SZ_2M, &descs->hw, flags);
+					IOAT_CHUNK_SIZE, &descs->hw, flags);
 		if (!descs->virt) {
 			int idx;
 

base-commit: ba4f184e126b751d1bffad5897f263108befc780
-- 
2.20.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] dmaengine: ioat: Allocate correct size for descriptor chunk
  2020-09-22 20:08 [PATCH] dmaengine: ioat: Allocate correct size for descriptor chunk Logan Gunthorpe
@ 2020-09-22 20:18 ` Dave Jiang
  2020-10-05  4:46 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Dave Jiang @ 2020-09-22 20:18 UTC (permalink / raw)
  To: Logan Gunthorpe, dmaengine, linux-kernel
  Cc: Robin Murphy, Vinod Koul, Dan Williams



On 9/22/2020 1:08 PM, Logan Gunthorpe wrote:
> dma_alloc_coherent() is called with a fixed SZ_2M size, but frees happen
> with IOAT_CHUNK_SIZE. Recently, IOAT_CHUNK_SIZE was reduced to 512M but
> the allocation did not change. To fix, change to using the
> IOAT_CHUNK_SIZE define.
> 
> This was caught with the upcoming patchset for converting Intel platforms to the
> dma-iommu implementation. It has a warning when the unmapped size differs from
> the mapped size.
> 
> Fixes: a02254f8a676 ("dmaengine: ioat: Decreasing allocation chunk size 2M->512K")
> Link: https://lore.kernel.org/intel-gfx/776771a2-247a-d1be-d882-bee02d919ae0@deltatee.com/
> Suggested-by: Robin Murphy <robin.murphy@arm.com>
> Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
> Cc: Vinod Koul <vkoul@kernel.org>
> Cc: Dave Jiang <dave.jiang@intel.com>
> Cc: Dan Williams <dan.j.williams@intel.com>

Acked-by: Dave Jiang <dave.jiang@intel.com>

Thanks Logan.

> ---
>   drivers/dma/ioat/dma.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c
> index a814b200299b..07296171e2bb 100644
> --- a/drivers/dma/ioat/dma.c
> +++ b/drivers/dma/ioat/dma.c
> @@ -389,7 +389,7 @@ ioat_alloc_ring(struct dma_chan *c, int order, gfp_t flags)
>   		struct ioat_descs *descs = &ioat_chan->descs[i];
>   
>   		descs->virt = dma_alloc_coherent(to_dev(ioat_chan),
> -						 SZ_2M, &descs->hw, flags);
> +					IOAT_CHUNK_SIZE, &descs->hw, flags);
>   		if (!descs->virt) {
>   			int idx;
>   
> 
> base-commit: ba4f184e126b751d1bffad5897f263108befc780
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] dmaengine: ioat: Allocate correct size for descriptor chunk
  2020-09-22 20:08 [PATCH] dmaengine: ioat: Allocate correct size for descriptor chunk Logan Gunthorpe
  2020-09-22 20:18 ` Dave Jiang
@ 2020-10-05  4:46 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2020-10-05  4:46 UTC (permalink / raw)
  To: Logan Gunthorpe
  Cc: dmaengine, linux-kernel, Robin Murphy, Dave Jiang, Dan Williams

On 22-09-20, 14:08, Logan Gunthorpe wrote:
> dma_alloc_coherent() is called with a fixed SZ_2M size, but frees happen
> with IOAT_CHUNK_SIZE. Recently, IOAT_CHUNK_SIZE was reduced to 512M but
> the allocation did not change. To fix, change to using the
> IOAT_CHUNK_SIZE define.
> 
> This was caught with the upcoming patchset for converting Intel platforms to the
> dma-iommu implementation. It has a warning when the unmapped size differs from
> the mapped size.

Applied, thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-22 20:08 [PATCH] dmaengine: ioat: Allocate correct size for descriptor chunk Logan Gunthorpe
2020-09-22 20:18 ` Dave Jiang
2020-10-05  4:46 ` Vinod Koul

dmaengine Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dmaengine/0 dmaengine/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dmaengine dmaengine/ https://lore.kernel.org/dmaengine \
		dmaengine@vger.kernel.org
	public-inbox-index dmaengine

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.dmaengine


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git