Re: [RFC] generic device DMA implementation

James Bottomley (James.Bottomley@SteelEye.com)
Thu, 05 Dec 2002 09:03:24 -0600


david@gibson.dropbear.id.au said:
> But if you have the sync points, you don't need a special allocater
> for the memory at all - any old RAM will do. So why not just use
> kmalloc() to get it.

Because with kmalloc, you have to be aware of platform implementations. Most
notably that cache flush/invalidate instructions only operate at the level of
certain block of memory (called the cache line width). If kmalloc returns
less than a cache line width you have the potential for severe cockups because
of the possibility of interfering cache operations on adjacent kmalloc regions
that share the same cache line.

the dma_alloc... function guarantees to avoid this for you by passing the
allocation to the platform layer which knows the cache characteristics and
requirements for the machine (and dma controller) you're using.

James

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/