Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp1395444imp; Fri, 22 Feb 2019 02:38:10 -0800 (PST) X-Google-Smtp-Source: AHgI3IbnjJT4Fgb+oCbxBPwq8Wd3pWeISZtLsLrijNADPbLQkxuZLT6K9uRyVV/YHAIozDv6s7Zh X-Received: by 2002:a62:449b:: with SMTP id m27mr3560440pfi.79.1550831890281; Fri, 22 Feb 2019 02:38:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550831890; cv=none; d=google.com; s=arc-20160816; b=Q2DsO/EuYBbXZaa6ConL9H0pJ3LpjzazrrZMNh1LVNc5KXBfEpDrtZrBcxlxAmlXrB KV1mmAv+/5MUrfGhhEWpB5cyW7VUO6nOeL/xsIYGhhUQkBoF6tAtVzyuY3aNQULTVtou YJ4gsKrZgyPBElgzBU2vyhTDBuEfEArdCLwzZCbASD/ahOk36+zZqXWsozYTIgjR9ECq EahAh9VD5KpoiHCyuqerBJyb6/EG+GXt7rn1Ba0TR8cYAzbU3jrQodbsmmqGb6wTcaHO 3LxcubDUjiqHPqkN16LQg6ITPYk9fMfa23FoLF/eKmN00QIqlCg/1FvF/WbsaCm0Zi0C FmAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=xQOgP7C8URL3EZqSESgQ4rAp4JKCAOmthaG4uKnwgHM=; b=ZdTRZwl2Oh7eATZS/VaLfEKoCKBZT4OB9ol85bi57Gdageurbyn1EpcxSkBsVvdPUe GYvT9rKszZsvTtHNAg0FcPLmgS1gV6RfuGaKLsz0LniJZvneU7B4d/1+yFQ8BjZ6vK5d nJ8vdVASxZXWaglzItTj/+X0+ia2+VFDHsMZoLbp2PewuKSQ1W0EnStkQlvTG03O5ipD yFp/Spu9pebDeAOW5N1Xx7UBcEnYsqHrZyd19VwQTPMi7kqACNwzy1X160BGUtiHUEJj neEu1NDiaCZ9KPVl4UP6EpMs2BtSwI8uE8V0ZYGV4XFPZ7ZlUlEEeT3G76757CgiMZyO s9IA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t62si1052365pgd.369.2019.02.22.02.37.54; Fri, 22 Feb 2019 02:38:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726711AbfBVKhf (ORCPT + 99 others); Fri, 22 Feb 2019 05:37:35 -0500 Received: from mx2.suse.de ([195.135.220.15]:51158 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725944AbfBVKhe (ORCPT ); Fri, 22 Feb 2019 05:37:34 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 697DCAD29; Fri, 22 Feb 2019 10:37:33 +0000 (UTC) Date: Fri, 22 Feb 2019 11:37:32 +0100 From: Petr Mladek To: John Ogness Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Sergey Senozhatsky , Steven Rostedt , Daniel Wang , Andrew Morton , Linus Torvalds , Greg Kroah-Hartman , Alan Cox , Jiri Slaby , Peter Feiner , linux-serial@vger.kernel.org, Sergey Senozhatsky Subject: Re: [RFC PATCH v1 11/25] printk_safe: remove printk safe code Message-ID: <20190222103732.zkcvjijtdcfu4vbt@pathway.suse.cz> References: <20190212143003.48446-1-john.ogness@linutronix.de> <20190212143003.48446-12-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190212143003.48446-12-john.ogness@linutronix.de> User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 2019-02-12 15:29:49, John Ogness wrote: > vprintk variants are now NMI-safe so there is no longer a need for > the "safe" calls. > > NOTE: This also removes printk flushing functionality. > > Signed-off-by: John Ogness > --- > include/linux/hardirq.h | 2 - > include/linux/printk.h | 27 --- > init/main.c | 1 - > kernel/kexec_core.c | 1 - > kernel/panic.c | 3 - > kernel/printk/Makefile | 1 - > kernel/printk/internal.h | 30 +--- > kernel/printk/printk.c | 13 +- > kernel/printk/printk_safe.c | 427 -------------------------------------------- > kernel/trace/trace.c | 2 - > lib/nmi_backtrace.c | 6 - > 11 files changed, 7 insertions(+), 506 deletions(-) > delete mode 100644 kernel/printk/printk_safe.c From my POV, this is the primary selling argument for the new ring buffer. > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c > index b6a6f1002741..073ff9fd6872 100644 > --- a/kernel/printk/printk.c > +++ b/kernel/printk/printk.c > @@ -1752,6 +1745,11 @@ asmlinkage int vprintk_emit(int facility, int level, > } > EXPORT_SYMBOL(vprintk_emit); > > +__printf(1, 0) int vprintk_func(const char *fmt, va_list args) > +{ > + return vprintk_emit(0, LOGLEVEL_DEFAULT, NULL, 0, fmt, args); > +} All vprintk_func() calls should get replaced with vprintk_default(). It includes a crazy hack to reuse some kernel code (that calls printk() in kdb code. > asmlinkage int vprintk(const char *fmt, va_list args) > { > return vprintk_func(fmt, args); > diff --git a/lib/nmi_backtrace.c b/lib/nmi_backtrace.c > index 15ca78e1c7d4..77bf84987cda 100644 > --- a/lib/nmi_backtrace.c > +++ b/lib/nmi_backtrace.c > @@ -75,12 +75,6 @@ void nmi_trigger_cpumask_backtrace(const cpumask_t *mask, > touch_softlockup_watchdog(); > } > > - /* > - * Force flush any remote buffers that might be stuck in IRQ context > - * and therefore could not run their irq_work. > - */ > - printk_safe_flush(); > - > clear_bit_unlock(0, &backtrace_flag); > put_cpu(); > } This reminds me that we need to add back the locking that was removed in the commit 03fc7f9c99c1e7ae2925d45 ("printk/nmi: Prevent deadlock when accessing the main log buffer in NMI"). Otherwise, backtraces from different CPUs would get mixed. We need to add this before redirecting printk() to the new ring buffer. Best Regards, Petr