On Tuesday 06 February 2007 7:57 am, Alan Stern wrote: > On Tue, 6 Feb 2007, Ben Gardner wrote: > > > The CP210x currently does a kcalloc() to create a temporary buffer > > that has a maximum size of 16 bytes. This patch uses the stack for the > > buffer. > > This part of the patch is incorrect. The buffer must be allocated using > kmalloc or equivalent because some architectures cannot do DMA to stack > memory.
Actually a better reason is that while most architectures can DMA to the stack, most of them will have cache aliasing problems with it, such that data read onto the stack may then be discarded. Consider a cachline with { data before, buffer, data after } ... the cacheline will be flushed before DMA, then some CPU modifies either the before or after data (or both!) thereby dirtying the cacheline again. DMA completes, CPU checks the buffer, nothing changed. The dirty cacheline gets written out; it's as if the buffer never changed. If the cache does bus snooping (it does on x86) that failure won't happen ... but most architectures don't bother with such snooping, which is expensive and only serves to cover up buggy code. - Dave ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel