From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754622AbcBZO50 (ORCPT ); Fri, 26 Feb 2016 09:57:26 -0500 Received: from mx2.suse.de ([195.135.220.15]:39069 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754142AbcBZO5Z (ORCPT ); Fri, 26 Feb 2016 09:57:25 -0500 Date: Fri, 26 Feb 2016 15:57:22 +0100 From: Petr Mladek To: Sergey Senozhatsky Cc: Andrew Morton , Jan Kara , Peter Zijlstra , Steven Rostedt , Ingo Molnar , linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: Re: [PATCH] printk/nmi: restore printk_func in nmi_panic Message-ID: <20160226145717.GZ12548@pathway.suse.cz> References: <1456457840-1059-1-git-send-email-sergey.senozhatsky@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1456457840-1059-1-git-send-email-sergey.senozhatsky@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 2016-02-26 12:37:20, Sergey Senozhatsky wrote: > 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(); \ This might end up in a deadlock that printk_nmi() wanted to avoid. I think about a compromise. We should try to get the messages out only when kdump is not enabled. If the kdump is enabled we should avoid the risk a the deadlock here and let people to find the messages in the dump. I am going to play with this a bit. Best Regards, Petr PS: I am sorry for not responding much about the printk problems this week. I have attended a training and did not have much time for a real work.