diff options
author | Jim Keniston <jkenisto@us.ibm.com> | 2011-03-25 12:47:58 +0000 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2011-03-30 10:36:23 +1100 |
commit | 15d260b36facc1aa769fb39b0efc41f4c8c44729 (patch) | |
tree | d78ebb09c4b8b49868cf575a6a7166364906094d | |
parent | ff56535d294245b75fd8f79633b935a3b85993c8 (diff) |
powerpc/nvram: Don't overwrite oops/panic report on normal shutdown
For normal halt, reboot, and poweroff events, refrain from overwriting
the lnx,oops-log partition. Also, don't save the dmesg buffer on an
emergency-restart event if we've already saved it earlier in panic().
Signed-off-by: Jim Keniston <jkenisto@us.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r-- | arch/powerpc/platforms/pseries/nvram.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/pseries/nvram.c b/arch/powerpc/platforms/pseries/nvram.c index 419707b0724..00cc3a09488 100644 --- a/arch/powerpc/platforms/pseries/nvram.c +++ b/arch/powerpc/platforms/pseries/nvram.c @@ -480,8 +480,32 @@ static void oops_to_nvram(struct kmsg_dumper *dumper, const char *new_msgs, unsigned long new_len) { static unsigned int oops_count = 0; + static bool panicking = false; size_t text_len; + switch (reason) { + case KMSG_DUMP_RESTART: + case KMSG_DUMP_HALT: + case KMSG_DUMP_POWEROFF: + /* These are almost always orderly shutdowns. */ + return; + case KMSG_DUMP_OOPS: + case KMSG_DUMP_KEXEC: + break; + case KMSG_DUMP_PANIC: + panicking = true; + break; + case KMSG_DUMP_EMERG: + if (panicking) + /* Panic report already captured. */ + return; + break; + default: + pr_err("%s: ignoring unrecognized KMSG_DUMP_* reason %d\n", + __FUNCTION__, (int) reason); + return; + } + if (clobbering_unread_rtas_event()) return; |