lkml.org 
[lkml]   [2011]   [Mar]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 0/6] get rid of on-stack dma buffers
On Mon, 21 Mar 2011, Florian Mickler wrote:

> To be blunt, I'm not shure I fully understand the requirements myself.
> But as far as I grasped it, the main problem is that we need memory
> which the processor can see as soon as the device has scribbled upon it.
> (think caches and the like)
>
> Somewhere down the line, the buffer to usb_control_msg get's to be a
> parameter to dma_map_single which is described as part of the DMA API in
> Documentation/DMA-API.txt
>
> The main point I filter out from that is that the memory has to begin
> exactly at a cache line boundary...
>
> I guess (not verified), that the dma api takes sufficient precautions to
> abort the dma transfer if a timeout happens. So freeing _should_ not be
> an issue. (At least, I would expect big fat warnings everywhere if that
> were the case)
>
> I cc'd some people that hopefully will correct me if I'm wrong...

It all boils down to making sure that you don't free the memory which is
used as target of DMA transfer.

This is very likely to hit you when DMA memory region is on stack, but
blindly just converting this to kmalloc()/kfree() isn't any better if you
don't make sure that all the DMA transfers have been finished and device
will not be making any more to that particular memory region.

--
Jiri Kosina
SUSE Labs, Novell Inc.



\
 
 \ /
  Last update: 2011-03-22 12:03    [W:0.121 / U:0.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site