@@ -166,7 +166,7 @@ extern void die(const char *, struct pt_regs *, long);
void die_mce(const char *str, struct pt_regs *regs, long err);
extern bool die_will_crash(void);
extern void panic_flush_kmsg_start(void);
-extern void panic_flush_kmsg_end(void);
+extern void panic_flush_kmsg_end(bool dump);
#endif /* !__ASSEMBLY__ */
#endif /* __KERNEL__ */
@@ -169,9 +169,11 @@ extern void panic_flush_kmsg_start(void)
bust_spinlocks(1);
}
-extern void panic_flush_kmsg_end(void)
+extern void panic_flush_kmsg_end(bool dump)
{
- kmsg_dump(KMSG_DUMP_PANIC);
+ if (dump)
+ kmsg_dump(KMSG_DUMP_PANIC);
+
bust_spinlocks(0);
debug_locks_off();
console_flush_on_panic(CONSOLE_FLUSH_PENDING);
@@ -641,7 +641,7 @@ void __noreturn pnv_platform_error_reboot(struct pt_regs *regs, const char *msg)
show_regs(regs);
smp_send_stop();
- panic_flush_kmsg_end();
+ panic_flush_kmsg_end(true);
/*
* Don't bother to shut things down because this will
@@ -102,7 +102,7 @@ static void ps3_panic(char *str)
printk(" System does not reboot automatically.\n");
printk(" Please press POWER button.\n");
printk("\n");
- panic_flush_kmsg_end();
+ panic_flush_kmsg_end(false);
while(1)
lv1_pause(1);
@@ -856,7 +856,7 @@ static void __init pSeries_setup_arch(void)
static void pseries_panic(char *str)
{
- panic_flush_kmsg_end();
+ panic_flush_kmsg_end(false);
rtas_os_term(str);
}
Currently both pseries and ps3 are platforms that define special panic notifiers that run as callbacks inside powerpc generic panic notifier. In both cases kmsg_dump() is called, and the reason seems to be that both of these callbacks aims to effectively stop the machine, so nothing would execute after that - hence, both force a series of console flushing related operations, after calling the kmsg dumpers. Happens that recently the panic path was refactored, and now kmsg_dump() is *certainly* called before the pre_reboot panic notifiers, category in which both pseries/ps3 callbacks belong. In other words: kmsg_dump() will execute twice in both platforms, on panic path. This patch prevents that by disabling the kmsg_dump() for both platform's notifiers. But worth to notice that PowerNV still has a legit use for executing kmsg_dump() in its unrecoverable error path, so we rely in parameter passing to differentiate both cases. Also, since the pre_reboot notifiers still run earlier than console flushing routines, we kept that for both pseries and ps3 platforms, only skipping kmsg_dump(). Fixes: 35adacd6fc48 ("powerpc/pseries, ps3: panic flush kernel messages before halting system") Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Hari Bathini <hbathini@linux.ibm.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Nicholas Piggin <npiggin@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com> --- We'd like to thanks specially the MiniCloud infrastructure [0] maintainers, that allow us to test PowerPC code in a very complete, functional and FREE environment. [0] https://openpower.ic.unicamp.br/minicloud arch/powerpc/include/asm/bug.h | 2 +- arch/powerpc/kernel/traps.c | 6 ++++-- arch/powerpc/platforms/powernv/opal.c | 2 +- arch/powerpc/platforms/ps3/setup.c | 2 +- arch/powerpc/platforms/pseries/setup.c | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-)