At Thu, 08 Aug 2013 09:16:27 +0200, Clemens Ladisch wrote:
Takashi Iwai wrote:
Alan Stern wrote:
A buffer _can_ be in the middle of a kmalloc'ed space, but the CPU must not access any of the fields around it that might occupy the same cache line while the buffer is being used for DMA.
Hrm, but does the kmalloc buffer always guarantee such cache line exclusiveness...? I thought a simple one like SLOB doesn't care.
Documentation/DMA-API-HOWTO.txt says: | Architectures must ensure that kmalloc'ed buffer is | DMA-safe. Drivers and subsystems depend on it. If an architecture | isn't fully DMA-coherent (i.e. hardware doesn't ensure that data in | the CPU cache is identical to data in main memory), | ARCH_DMA_MINALIGN must be set so that the memory allocator | makes sure that kmalloc'ed buffer doesn't share a cache line with | the others.
Ah, good, thanks!
Takashi