Am Freitag, 14. Dezember 2007 20:02:52 schrieb Sarah Sharp:
> > I am sorry, you can't do this. This is DMA on the stack. You must kmalloc
> > buf.
> 
> So you can't pass a buffer on the stack, even when we know the stack is going 
> to
> stick around because we're calling usb_control_msg() ?  Is this because the 
> URB
> completes in interrupt context?

It is because DMA has to flush a full cache line on the incoherent arches.

1. submit URB
2. flush cacheline from CPU caches
3. start IO, wait for completion
4. read result from _memory_

Now suppose the cacheline is on the stack and you take an interrupt.
With a bit of bad luck your buffer is in the topmost cacheline which you use
to handle the interrupt. Its content is now again in the cache. In step 4
you'll read garbage.

        Regards
                Oliver



-
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to