LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   Cache invalidation (https://www.linuxquestions.org/questions/linux-kernel-70/cache-invalidation-4175437903/)

vishnunarayana 11-20-2012 12:12 AM

Cache invalidation
 
" Either flush or invalidate the cache lines corresponding to the buffer accessed by DMA and processor at strategic times "

What is the exact meaning of "invalidate the cache lines corresponding to the buffer accessed by DMA" in the above context.


Thanks,
vishnu

malekmustaq 11-20-2012 12:26 AM

Flush the cache by rewriting it down with zeroes. Invalidate it by preventing another write into the mapped memory or diverting its contents to null.

You are talking of kernel events; and I don't know exactly what you are doing. At least I made a try to put you up and gain attention from the better helpers around rather than leave your post to age without reply.

Hope that helps. Good luck.

sundialsvcs 11-20-2012 07:27 AM

Actually, that's not quite right ... I think.

"The cache" refers to the on-chip cache lines that are part of the virtual-memory subsystem, used to avoid repeated reference to page and segment tables (which, of course, would triple the number of memory accesses and thereby bring the whole thing to a screeching plod). When you do something that affects segmentation, e.g. discarding stuff, changing page-table entries and so on, you must invalidate those parts of the CPU caches. (And all CPUs must do so.) There are established procedures and macros etc. for this. They must be followed precisely, so that your code is 100%-reliable on all processors, in actual conditions under heavy loads.

I don't momentarily recall if the CPU will attempt to cache content, but it would not surprise me. Suffice it to say that, anywhere a cache could be present, you must correctly advise the hardware when to invalidate it, and you must do so in the most specific (hence, least intrusive) way possible.


All times are GMT -5. The time now is 03:53 PM.