Fwd: Cache mappings and invalidate

Bjorn Wesen bjorn.wesen at axis.com
Tue Nov 13 20:15:22 EST 2001


On Tue, 13 Nov 2001, David Woodhouse wrote:
> No. I suggested we implement simon_says_flush_dcache_range() et al, but 
> Linus didn't seem to like that :)
> 
> > > Linus seems to think this is a Good Thing. 
> > hmm, why should this be a Good Thing?
> 
> No clue.

I don't know what he is thinking exactly, but one reason is that there is
no way the arch-independent code can know for sure that a cache _needs_ to
be flushed in many cases, because there are so many ways to design a
cache. Erasing a flash sector is obvious, but other things are not and you
certainly don't want to flush the cache if you don't absolutely need to.

All it can do is give a hint which might be useful to implement in some
architectures only.. For example, a cache invalidate is called all the
time during page remappings, but for most architectures you don't need to
flush it at those times and doing it would just waste time. 

So what you really want, is to rename those cache flushes in the mm code
into a name saying what they try to do, let some archs implement that as a
cache flush if needed, and reserve the real cache flush code into a
function that you need to implement (and use that in MTD perhaps).

You _dont_ want to implement the flush_cache_* functions that exist right
now on all architectures, not the way they are used.

/BW





More information about the linux-mtd mailing list