cache invalidate in user space

Mar 15, 2006 6 Replies

Does anybody know how can I invalidate content of the cache in user space = user process/thread? Thanks.



1) What architecture 2) Why (maybe there are better solutions)

JB

PowerPC. Just D-cache. What I'm doing right now is that I fill dummy buffer - which makes content of the D-cache filled by that dummy buffer. But for future it slows down execution.

But why are you doing it ? It's hard to think of a good reason.

Hmmm. Why it slows down execution? The PowerPC has separate I cache. Or do you work with a large amount of data? So the next steps are slowed down due to flushing old d cache content?

With the PowerPC architecture you have a bunch of cache control instructions also in userspace. See the architecture manual and search for instructions like "dcbz" (very powerfull to zero out memory areas), "dcbf" to flush specific address spaces (that is what you need) and "dcbt" to preload data before using. With "dcbt" and "dcbf" in a loop you can handle a huge amount of data in a very efficient way (flush n, touch n+2, modify n+1, loop with n=n+1).

See the GNU libc string and memory functions in the PowerPC part how to use these assembler instructions from "C" code...

Hope it helps. Juergen

snipped-for-privacy@yahoo.com =EC=9E=91=EC=84=B1:

AFAIK it's almost impossible. I think you'd better write a small device driver and use it to do the necessary job.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required