From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752155AbdBFQzN (ORCPT ); Mon, 6 Feb 2017 11:55:13 -0500 Received: from mail.kernel.org ([198.145.29.136]:58492 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751001AbdBFQzL (ORCPT ); Mon, 6 Feb 2017 11:55:11 -0500 Date: Mon, 6 Feb 2017 11:55:04 -0500 From: Steven Rostedt To: Sergey Senozhatsky Cc: Petr Mladek , Sergey Senozhatsky , Andrew Morton , Linus Torvalds , Jan Kara , Tejun Heo , Calvin Owens , Ingo Molnar , Peter Zijlstra , Andy Lutomirski , Peter Hurley , linux-kernel@vger.kernel.org Subject: Re: [PATCHv7 4/8] printk: always use deferred printk when flush printk_safe lines Message-ID: <20170206115504.57310725@gandalf.local.home> In-Reply-To: <20170206164253.GA463@tigerII.localdomain> References: <20170201110648.33651ee8@gandalf.local.home> <20170202060538.GA419@jagdpanzerIV.localdomain> <20170202153753.GF23754@pathway.suse.cz> <20170202155252.GG23754@pathway.suse.cz> <20170203020418.GC6228@jagdpanzerIV.localdomain> <20170203111849.GO23754@pathway.suse.cz> <20170206014846.GA1750@jagdpanzerIV.localdomain> <20170206020820.GB1750@jagdpanzerIV.localdomain> <20170206121652.GA2769@pathway.suse.cz> <20170206082739.18a47c8e@gandalf.local.home> <20170206164253.GA463@tigerII.localdomain> X-Mailer: Claws Mail 3.14.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 7 Feb 2017 01:42:53 +0900 Sergey Senozhatsky wrote: > On (02/06/17 08:27), Steven Rostedt wrote: > [..] > > > > > just in case, the patch (which I prefer to be ignored) > > > > > > > > let's keep printk_safe_flush_line(). > > > > > > I do not have strong opinion but I would slightly prefer > > > to keep the helper function. The use of printk_deferred() > > > is a bit tricky and it is better to have only one copy. > > > > > > Steven, could you live with the original patch, please? > > > > Sure, but make it into a static inline. > > well, I'll be surprised if gcc doesn't inline that simple one-liner. I never trust gcc ;-) It's been known to uninline simple one liners before that have been marked as "inline" :-p > > attached. no conflicts, the patch can replace 0004. > > ===8<===8<=== > > >From 69bbb0f436a2a89ec41a5831c03490e0a78ce12e Mon Sep 17 00:00:00 2001 > From: Sergey Senozhatsky > Date: Tue, 27 Dec 2016 23:16:07 +0900 > Subject: [PATCH] printk: always use deferred printk when flush printk_safe > lines > > Always use printk_deferred() in printk_safe_flush_line(). > Flushing can be done from NMI or printk_safe contexts (when > we are in panic), so we can't call console drivers, yet still > want to store the messages in the logbuf buffer. Therefore we > use a deferred printk version. > > Signed-off-by: Sergey Senozhatsky > Suggested-by: Petr Mladek > Signed-off-by: Petr Mladek Reviewed-by: Steven Rostedt (VMware) -- Steve > --- > kernel/printk/printk_safe.c | 14 ++++++-------- > 1 file changed, 6 insertions(+), 8 deletions(-) > > diff --git a/kernel/printk/printk_safe.c b/kernel/printk/printk_safe.c > index efc89a4e9df5..5214d326d3ba 100644 > --- a/kernel/printk/printk_safe.c > +++ b/kernel/printk/printk_safe.c > @@ -110,17 +110,15 @@ static int printk_safe_log_store(struct printk_safe_seq_buf *s, > return add; > } > > -static void printk_safe_flush_line(const char *text, int len) > +static inline void printk_safe_flush_line(const char *text, int len) > { > /* > - * The buffers are flushed in NMI only on panic. The messages must > - * go only into the ring buffer at this stage. Consoles will get > - * explicitly called later when a crashdump is not generated. > + * Avoid any console drivers calls from here, because we may be > + * in NMI or printk_safe context (when in panic). The messages > + * must go only into the ring buffer at this stage. Consoles will > + * get explicitly called later when a crashdump is not generated. > */ > - if (in_nmi()) > - printk_deferred("%.*s", len, text); > - else > - printk("%.*s", len, text); > + printk_deferred("%.*s", len, text); > } > > /* printk part of the temporary buffer line by line */