suppose I'm writing to a RAM location on a Core Duo system through L1/L2 cache.
Suppose I am going开发者_如何学Python to write to a persistent location in RAM and panic Linux kernel soon after that. The location is persistent meaning that it won't be re-inited during CPU reboot and will be picked up after reboot.
Will Linux flush CPU cache as a part of reboot/panic?
Will the CPU flush cache before rebooting?
Or should I do that manually? How?
Update: my cache is not write-through.
The question is, does the CPU spec define this behavior?
Probably the most appropriate way to do this would be to mark the page containing the persistent location(s) as non-cacheable. That way writes to the persistent location(s) would always bypass the cache (effectively write-through). Of course it may be that your cache is write-through anyway, so this may be redundant - you should check this first.
The cache may not be flushed because a system diagnostic or debugger may need to be run by a user, system engineer or IT support person to diagnose and dump the computer state. The cache may be flushed at startup or not and this depends on the type and version of operating system, programming language and application in use at the event. It may be a selectable option (from any BIOS) at start up time but It would likely be initialized at poweron but not necessarily at warm restart if available.
I guess this might come in handy:) http://lxr.linux.no/#linux+v2.6.30/arch/x86/kernel/reboot.c
精彩评论