CHROMIUM: ramoops: Copy the entire buffer to deal with bit rot
authorSameer Nanda <snanda@chromium.org>
Thu, 30 Aug 2012 16:48:10 +0000 (09:48 -0700)
committerGerrit <chrome-bot@google.com>
Thu, 30 Aug 2012 22:53:35 +0000 (15:53 -0700)
commit4aa82798833de5023d60a81cd1abd118da03a0f1
tree1ceacd0773c25685c2b1a4890dc2c2ba82246472
parentd7d05b4f17e424da125c1c94a6f73eaed7bc03f3
CHROMIUM: ramoops: Copy the entire buffer to deal with bit rot

If unclean shutdown is done by yanking power rails, the RAM may be in a
state where it is not getting refreshed for a short period of time. This
can cause bit rotting in RAM and throw off the wraparound and buffer
size calculation logic. To get around this, copy the entire console
buffer. Note that this, of course, won't do anything to fix the bit
rotting but the intent here is that some logs are better than none.

Also squeezed in a minor cleanup of renaming headp to tailp since it
really tracks the tail, not head.

BUG=chrome-os-partner:13249
TEST=on a snow system do a warm reboot by either issuing the
"warm_reboot" command from servo ec console or by pressing
alt-volume_up-r keys together. The system should reboot. Upon bootup,
check contents of "/dev/pstore/console-ramoops" and ensure they are from
dmesg of the previous boot.

Change-Id: I999e95bf854fff26265404a680255f25cc2f7fe6
Signed-off-by: Sameer Nanda <snanda@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/31909
Reviewed-by: Mandeep Singh Baines <msb@chromium.org>
drivers/char/ramoops.c