Skip to contentSkip to conversation

dma-debug: check_for_stack background?

DISCUSSION Stefan Richter 5 participants 7 messages Jun 14, 2009 – Jun 16, 2009

lore
Share & tools
lore
#0 lore raw

Hi,

it took a while but I finally noticed that the DMA debug facility warns about mappings of on-stack memory. What's the problem with that? Are there architectures which don't support such mappings, or is it a question of caution not to DMA-map the stack?

Signature · 3 lines
Stefan Richter
-=====-==--= -==- -===-
http://arcgraph.de/sr/
#1 lore raw
Quoted 6 lines · Stefan Richter

Hi,

it took a while but I finally noticed that the DMA debug facility warns about mappings of on-stack memory. What's the problem with that? Are there architectures which don't support such mappings, or is it a question of caution not to DMA-map the stack?

I'm not sure if it is possible on all architectures, however the DMA mapping documentation prohibts the use of stack memory.

Signature · 3 lines
Ben ([email protected], http://www.fluff.org/)

  'a smiley only costs 4 bytes'
#2 lore raw
Quoted 2 lines · Ben Dooks
Quoted 1 line · Stefan Richter

the DMA debug facility warns about mappings of on-stack memory. What's the problem with that?

...

Quoted 2 lines

I'm not sure if it is possible on all architectures, however the DMA mapping documentation prohibts the use of stack memory.

Ah, it has all been documented in plain sight for ages. Thanks for the pointer.

Signature · 3 lines
Stefan Richter
-=====-==--= -==- -===-
http://arcgraph.de/sr/
#3 lore raw
Quoted 10 lines · Stefan Richter
Quoted 3 lines · Ben Dooks
Quoted 2 lines · Stefan Richter

the DMA debug facility warns about mappings of on-stack memory. What's the problem with that?

...

Quoted 2 lines

I'm not sure if it is possible on all architectures, however the DMA mapping documentation prohibts the use of stack memory.

Ah, it has all been documented in plain sight for ages. Thanks for the pointer.

Problem is that the stack might go away or could be otherwise reused while the DMA is in-flight. This could cause really hard to debug problems.

Joerg

Signature · 6 lines
           | Advanced Micro Devices GmbH
 Operating | Karl-Hammerschmidt-Str. 34, 85609 Dornach bei München
 System    | 
 Research  | Geschäftsführer: Thomas M. McCoy, Giuliano Meroni
 Center    | Sitz: Dornach, Gemeinde Aschheim, Landkreis München
           | Registergericht München, HRB Nr. 43632
#4 lore raw
Quoted 9 lines · On Mon, 15 Jun 2009 10:13:55 +0200 Joerg Roedel <[email protected]> wrote:
Quoted 8 lines · Stefan Richter
Quoted 3 lines · Ben Dooks
Quoted 2 lines · Stefan Richter

the DMA debug facility warns about mappings of on-stack memory. What's the problem with that?

...

Quoted 2 lines

I'm not sure if it is possible on all architectures, however the DMA mapping documentation prohibts the use of stack memory.

Quoted 6 lines
Quoted 2 lines

Ah, it has all been documented in plain sight for ages. Thanks for the pointer.

Problem is that the stack might go away or could be otherwise reused while the DMA is in-flight. This could cause really hard to debug problems.

Not true. Even if you use the stack buffer for DMA synchronously, it doesn't work (we had the bad code like starting dma and waiting for the completion).

On some architectures, we can't use the stack buffer for DMA. That's why the DMA mapping documentation prohibits the use of stack memory for DMA.

#5 lore raw

2009/6/16 FUJITA Tomonori <[email protected]>:

Quoted 15 lines
Quoted 12 lines · On Mon, 15 Jun 2009 10:13:55 +0200 Joerg Roedel <[email protected]> wrote:
Quoted 10 lines · Stefan Richter
Quoted 3 lines · Ben Dooks
Quoted 2 lines · Stefan Richter

the DMA debug facility warns  about mappings of on-stack memory. What's the problem with that?

...

Quoted 2 lines

I'm not sure if it is possible on all architectures, however the DMA mapping documentation prohibts the use of stack memory.

Ah, it has all been documented in plain sight for ages.  Thanks for the pointer.

Quoted 7 lines
Quoted 3 lines

Problem is that the stack might go away or could be otherwise reused while the DMA is in-flight. This could cause really hard to debug problems.

Not true. Even if you use the stack buffer for DMA synchronously, it doesn't work (we had the bad code like starting dma and waiting for the completion).

Yes, there is cache alignement problem for stack buffer also.

Quoted 10 lines

On some architectures, we can't use the stack buffer for DMA. That's why the DMA mapping documentation prohibits the use of stack memory for DMA.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Signature · 1 line
Lei Ming
#6 lore raw
In reply to FUJITA Tomonori
Quoted 15 lines · FUJITA Tomonori
Quoted 12 lines · On Mon, 15 Jun 2009 10:13:55 +0200 Joerg Roedel <[email protected]> wrote:
Quoted 10 lines · Stefan Richter
Quoted 3 lines · Ben Dooks
Quoted 2 lines · Stefan Richter

the DMA debug facility warns about mappings of on-stack memory. What's the problem with that?

...

Quoted 2 lines

I'm not sure if it is possible on all architectures, however the DMA mapping documentation prohibts the use of stack memory.

Ah, it has all been documented in plain sight for ages. Thanks for the pointer.

Quoted 7 lines
Quoted 3 lines

Problem is that the stack might go away or could be otherwise reused while the DMA is in-flight. This could cause really hard to debug problems.

Not true. Even if you use the stack buffer for DMA synchronously, it doesn't work (we had the bad code like starting dma and waiting for the completion).

I've not written that this is the only problem. I know that there may be others like the one you experienced. But what I wrote could also happen and is a problem :)

Joerg

Signature · 6 lines
           | Advanced Micro Devices GmbH
 Operating | Karl-Hammerschmidt-Str. 34, 85609 Dornach bei München
 System    | 
 Research  | Geschäftsführer: Thomas M. McCoy, Giuliano Meroni
 Center    | Sitz: Dornach, Gemeinde Aschheim, Landkreis München
           | Registergericht München, HRB Nr. 43632