From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753006AbcBZDge (ORCPT ); Thu, 25 Feb 2016 22:36:34 -0500 Received: from mail-pa0-f47.google.com ([209.85.220.47]:36304 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750996AbcBZDgd (ORCPT ); Thu, 25 Feb 2016 22:36:33 -0500 From: Sergey Senozhatsky X-Google-Original-From: Sergey Senozhatsky To: Petr Mladek Cc: Andrew Morton , Jan Kara , Peter Zijlstra , Steven Rostedt , Ingo Molnar , linux-kernel@vger.kernel.org, Sergey Senozhatsky , Sergey Senozhatsky Subject: [PATCH] printk/nmi: restore printk_func in nmi_panic Date: Fri, 26 Feb 2016 12:37:20 +0900 Message-Id: <1456457840-1059-1-git-send-email-sergey.senozhatsky@gmail.com> X-Mailer: git-send-email 2.7.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When watchdog detects a hardlockup and calls nmi_panic() `printk_func' must be restored via printk_nmi_exit() call, so panic() will be able to flush nmi buf and show backtrace and panic message. We also better explicitly ask nmi to printk_nmi_flush() in console_flush_on_panic(), because it may be too late to rely on irq work. Signed-off-by: Sergey Senozhatsky --- include/linux/kernel.h | 6 ++++-- kernel/printk/printk.c | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/linux/kernel.h b/include/linux/kernel.h index f4fa2b2..3ee33d5 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -469,10 +469,12 @@ do { \ cpu = raw_smp_processor_id(); \ old_cpu = atomic_cmpxchg(&panic_cpu, PANIC_CPU_INVALID, cpu); \ \ - if (old_cpu == PANIC_CPU_INVALID) \ + if (old_cpu == PANIC_CPU_INVALID) { \ + printk_nmi_exit(); \ panic(fmt, ##__VA_ARGS__); \ - else if (old_cpu != cpu) \ + } else if (old_cpu != cpu) { \ nmi_panic_self_stop(regs); \ + } \ } while (0) /* diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 9917f69..13a4022 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -2395,6 +2395,7 @@ void console_flush_on_panic(void) */ console_trylock(); console_may_schedule = 0; + printk_nmi_flush(); console_unlock(); } -- 2.7.1