[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <51A3C3F1.4080907@gmail.com>
Date: Mon, 27 May 2013 13:37:05 -0700
From: Alexander Duyck <alexander.duyck@...il.com>
To: Ming Lei <ming.lei@...onical.com>
CC: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
Shuah Khan <shuah.khan@...com>, Joerg Roedel <joro@...tes.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Alexander Duyck <alexander.h.duyck@...el.com>,
Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
Subject: Re: [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@...com>
> Cc: Joerg Roedel <joro@...tes.org>
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Cc: Alexander Duyck <alexander.h.duyck@...el.com>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
> Signed-off-by: Ming Lei <ming.lei@...onical.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists