From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751167AbcCVQgb (ORCPT ); Tue, 22 Mar 2016 12:36:31 -0400 Received: from mx2.suse.de ([195.135.220.15]:52886 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751142AbcCVQgQ (ORCPT ); Tue, 22 Mar 2016 12:36:16 -0400 Date: Tue, 22 Mar 2016 17:36:12 +0100 From: Petr Mladek To: Sergey Senozhatsky Cc: Andrew Morton , Jan Kara , Tejun Heo , Tetsuo Handa , linux-kernel@vger.kernel.org, Byungchul Park , Sergey Senozhatsky , Jan Kara Subject: Re: [RFC][PATCH v6 1/2] printk: Make printk() completely async Message-ID: <20160322163612.GB5522@pathway.suse.cz> References: <1458581130-8677-1-git-send-email-sergey.senozhatsky@gmail.com> <1458581130-8677-2-git-send-email-sergey.senozhatsky@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1458581130-8677-2-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 Tue 2016-03-22 02:25:29, Sergey Senozhatsky wrote: > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c > index e38579d..99c105d6 100644 > --- a/kernel/printk/printk.c > +++ b/kernel/printk/printk.c > @@ -1619,12 +1721,21 @@ asmlinkage int vprintk_emit(int facility, int level, > int printed_len = 0; > int nmi_message_lost; > bool in_sched = false; > - /* cpu currently holding logbuf_lock in this function */ > - static unsigned int logbuf_cpu = UINT_MAX; > + bool in_panic = console_loglevel == CONSOLE_LOGLEVEL_MOTORMOUTH; I am just looking at the printk in NMI patchset and I will need to deal with the panic state as well. I am not sure if this detection is secure. This console level is set also by kdb_show_stack() and kdb_dumpregs(). I am not sure how this kdb stuff works and if it affects normal kernel but... Anyway, it seems that many locations detects the panic situation via the variable oops_in_progress. It has another advantage that it can be easily checked and we would not need any extra variable here. > + bool sync_print = printk_sync; > + > + /* disable async printk */ > + if (in_panic) > + printk_sync = true; In each case, we should not switch the global state if we only print debug traces. Best Regards, Petr