[PATCH v2] fix wrong usage of dmaengine_unmap_put in async_xxx
xuelin.shi at freescale.com
Fri Apr 11 18:31:08 EST 2014
With https://patchwork.kernel.org/patch/3863711/ applied, the issue disappeared.
From: dan.j.williams at gmail.com [mailto:dan.j.williams at gmail.com] On Behalf Of Dan Williams
Sent: 2014年4月10日 12:02
To: Shi Xuelin-B29237
Cc: Koul, Vinod; dmaengine at vger.kernel.org; linuxppc-dev
Subject: Re: [PATCH v2] fix wrong usage of dmaengine_unmap_put in async_xxx
On Thu, Mar 20, 2014 at 1:16 AM, <xuelin.shi at freescale.com> wrote:
> From: Xuelin Shi <xuelin.shi at freescale.com>
> dmaengine_unmap_put does below two things:
> a) unmap pages for srcs and dests
> b) free unmap struct
> The unmap struct data is generated but only initialized while other
> some dma contions are met, like dma alignment etc.
> If the unmap data is not initialized, call dmaengine_unmap_put will
> unmap some random data in unmap->addr[...]
Actually, this should be fixed by your other patch:
Because the to_cnt, from_cnt, are properly initialized to zero. The only issue was that the unmap pool was not specified.
Can you verify that the problem still exists with that patch applied?
I'll mark it for -stable.
> Also call dmaengine_get_unmap_data immediatally after generating tx is
> not correct. Maybe the tx has not been finished by DMA hardware yet
> but the srcs and dests are dma unmapped.
I disagree. It is correct because the unmap data is reference counted. If the DMA hardware is still using the buffers then it must hold a reference on the unmap data. The dmaengine_put_unmap_data() instances your are removing are the ones that drop the initial reference count set in dmaengine_get_unmap_data().
More information about the Linuxppc-dev