lkml.org 
[lkml]   [2013]   [May]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH 1/2] dma-debug: allow size to become smaller in dma_unmap
On 05/27/2013 09:13 AM, Ming Lei wrote:
> This patch looses the check on DMA buffer size for streaming
> DMA unmap, based on the below fact:
>
> - it is common to see only part of DMA transfer is completed,
> especially in case of DMA_FROM_DEVICE
>
> So it isn't necessary to unmap the whole DMA buffer inside DMA
> unmapping, and unmapping the actual completed buffer should be more
> efficient. Considered that unmapping is often called in hard irq
> context, time of irq handling can be saved.
>
> Cc: Shuah Khan <shuah.khan@hp.com>
> Cc: Joerg Roedel <joro@8bytes.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Alexander Duyck <alexander.h.duyck@intel.com>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Signed-off-by: Ming Lei <ming.lei@canonical.com>

What you are proposing doesn't make much sense. If you are only wanting
to use part of a buffer then just use the dma_sync primitives.

The idea behind unmapping a buffer is to free any resources associated
with it. Calling map once, and unmap multiple times per buffer is just
asking for trouble in the form of use after free or memory leaks.

Thanks,

Alex



\
 
 \ /
  Last update: 2013-05-27 23:01    [W:0.064 / U:0.292 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site