printk_persist: flush the printk buffer all the way to RAM.
Previously, the buffer was getting stuck in L2 cache, which is lost on CPU
reset, so the last kernel messages before a reboot tended to be lost. This
was mitigated somewhat since switching to userspace seems to rapidly
invalidate most/all of the L2 cache, but usually the last kernel messages
before a reboot would be missing. This was especially true in the case of
kernel panics, unfortunately, which means we have probably been missing a
lot of kernel panics.
Performance effect on mindspeed c2000 CPU: for a loop printk'ing 1000
messages in a tight loop, flushing cache after each iteration:
original code: 8ms
flush_range on the entire 8MB printk_buffer: 7201ms
flush_range twice on the buffer: 14388ms
flush_all (no range specified): 138ms
flush_all twice: 253ms
flush_range only the logbits array: 8ms
flush_range logbits + only changed section of log_buf: 7ms
So:
- flushing twice takes twice as long.
- flushing a large range is slower than flushing everything.
- flushing just the right part makes it *faster*, which is a bit weird
(but the results were consistent across several runs)
Anyway, at least this patch doesn't make it slower.
Change-Id: I3b263be1816de2dbb4aecb806501ad36e23f47fe
1 file changed