From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10E22C2B9F4 for ; Fri, 25 Jun 2021 12:36:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E6C9261921 for ; Fri, 25 Jun 2021 12:36:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231653AbhFYMjM (ORCPT ); Fri, 25 Jun 2021 08:39:12 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:37804 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230461AbhFYMit (ORCPT ); Fri, 25 Jun 2021 08:38:49 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id EA2CB1FE8E; Fri, 25 Jun 2021 12:36:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1624624584; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=7WwlFfjzZ1Gum+16nGRv3muCKcaRSIAsgxa6F7g7/oU=; b=OeYxvhgasMbs1C4iwauKBACmiNMDd0tSDrThewMZ6zKe8VPNyBLvZJimgJIfLDGStY1fqD cKyIFjs+gpxRK0TUi+Gke3O3gFGVIw0Rt1k/bWtzIqhFZubH0mQn+FRw5U5DcmjHyChpKo ktEb3ho5wyguj6B2R30GozD0getgIAM= Received: from suse.cz (unknown [10.100.216.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id B92B4A3BB4; Fri, 25 Jun 2021 12:36:23 +0000 (UTC) Date: Fri, 25 Jun 2021 14:36:23 +0200 From: Petr Mladek To: John Ogness Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Russell King , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Ingo Molnar , Marc Zyngier , Valentin Schneider , Andrew Morton , Pekka Enberg , Mike Rapoport , "Wolfram Sang (Renesas)" , Anshuman Khandual , Peter Zijlstra , Frederic Weisbecker , Kees Cook , Masahiro Yamada , Nathan Chancellor , Sami Tolvanen , Alexei Starovoitov , Nick Terrell , Chris Wilson , Vlastimil Babka , linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH printk v3 4/6] printk: remove NMI tracking Message-ID: References: <20210624111148.5190-1-john.ogness@linutronix.de> <20210624111148.5190-5-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210624111148.5190-5-john.ogness@linutronix.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 2021-06-24 13:17:46, John Ogness wrote: > All NMI contexts are handled the same as the safe context: store the > message and defer printing. There is no need to have special NMI > context tracking for this. Using in_nmi() is enough. > > Signed-off-by: John Ogness > Reviewed-by: Petr Mladek > --- > arch/arm/kernel/smp.c | 2 -- > arch/powerpc/kexec/crash.c | 3 --- > include/linux/hardirq.h | 2 -- > include/linux/printk.h | 12 ------------ > init/Kconfig | 5 ----- > kernel/printk/internal.h | 6 ------ > kernel/printk/printk_safe.c | 37 +------------------------------------ > kernel/trace/trace.c | 2 -- > 8 files changed, 1 insertion(+), 68 deletions(-) > > diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c > index 74679240a9d8..0dd2d733ad62 100644 > --- a/arch/arm/kernel/smp.c > +++ b/arch/arm/kernel/smp.c > @@ -668,9 +668,7 @@ static void do_handle_IPI(int ipinr) > break; > > case IPI_CPU_BACKTRACE: > - printk_nmi_enter(); > nmi_cpu_backtrace(get_irq_regs()); > - printk_nmi_exit(); It looks to me that in_nmi() returns false here. As a result, nmi_cpu_backtrace() might newly call consoles immediately. If I recall correctly, arm does not have a proper NMI. And this is just some special case of a "normal" IRQ. And indeed, nmi_enter() is called only from handle_fiq_as_nmi() and it is just a boiler plate. If I am right, we should replace printk_nmi_enter() with printk_safe_enter_irqsave(flags) or so. Even better solution might be to call this within nmi_enter()/nmi_exit(). But I am not sure if this is what the arm people want. Best Regards, Petr PS: Sigh, I have skipped this patch yesterday because it already had my Reviewed-by. And I missed it before...