From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758780AbcH3WDR (ORCPT ); Tue, 30 Aug 2016 18:03:17 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45612 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752388AbcH3WDQ (ORCPT ); Tue, 30 Aug 2016 18:03:16 -0400 Date: Tue, 30 Aug 2016 15:03:15 -0700 From: Andrew Morton To: Sergey Senozhatsky Cc: Petr Mladek , Jan Kara , linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: Re: [PATCH v2] printk/nmi: avoid direct printk()-s from __printk_nmi_flush() Message-Id: <20160830150315.93efc592aa631f474af760b5@linux-foundation.org> In-Reply-To: <20160830161354.581-1-sergey.senozhatsky@gmail.com> References: <20160830161354.581-1-sergey.senozhatsky@gmail.com> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; 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 Wed, 31 Aug 2016 01:13:54 +0900 Sergey Senozhatsky wrote: > __printk_nmi_flush() can be called from nmi_panic(), therefore it has to > test whether it's executed in NMI context and thus must route the messages > through deferred printk() or via direct printk(). Why? What misbehaviour does the current code cause? > Except for two places > where __printk_nmi_flush() does unconditional direct printk() calls: > - pr_err("printk_nmi_flush: internal error ...") > - pr_cont("\n") > > Factor out print_nmi_seq_line() parts into a new printk_nmi_flush_line() > function, which takes care of in_nmi(), and use it in __printk_nmi_flush() > for printing and error-reporting.