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=-10.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, INVALID_DATE_TZ_ABSURD,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 1CC5EC49EA5 for ; Thu, 24 Jun 2021 11:11:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 031AB613DA for ; Thu, 24 Jun 2021 11:11:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232439AbhFXLOM (ORCPT ); Thu, 24 Jun 2021 07:14:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232341AbhFXLOK (ORCPT ); Thu, 24 Jun 2021 07:14:10 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 377C1C061756 for ; Thu, 24 Jun 2021 04:11:51 -0700 (PDT) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1624533109; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=cfuNbKyCExwbvfLByUf+i4tJc2rm0rFQn9eWtArqDyU=; b=IHgUrWjqvTv9XAnW/euiKoHwCs22cXM582fYW7cdZ/gzfBxO7r+42lCoPz/6AoII5OD3vC WUMEZkEBldDcku57tVr2rvTpeuygcckemySzvQ3FLrfSxnbxJcIsRMx4luDvkBtYFr1lHl Z1kclDpHstTRIFFbNIhgx2OMOe37Y2xiSjQUVkH1DiOYeK8BC30dH6MP3hEBxi+TINnr65 iFZdoBNAxFkiZMnbkkiL640e/KxI47jyT+B3b83bn9FXtsxdoVP9qYsozOKunTnMD+kMmU XdLGN1R2U9qscSjODZFD9WlP7BF7bv6uHjZjAQKqiaskUoJoReN0NHjL6mXugA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1624533109; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=cfuNbKyCExwbvfLByUf+i4tJc2rm0rFQn9eWtArqDyU=; b=UgtDgR4w/gAEfRB86XFxI5AihfurAOaChSakPiA9vEn2TUKTUSjCSlzlcmPcUfDeZYBtLI Ez3uSiW3f8JSHYCg== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, "Paul E. McKenney" , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Eric Biederman , Nicholas Piggin , Christophe Leroy , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Andrew Morton , Kees Cook , Tiezhu Yang , Yue Hu , Alexey Kardashevskiy , linuxppc-dev@lists.ozlabs.org, kexec@lists.infradead.org, Russell King , Ingo Molnar , Marc Zyngier , Valentin Schneider , Pekka Enberg , Mike Rapoport , "Wolfram Sang (Renesas)" , Anshuman Khandual , Peter Zijlstra , Frederic Weisbecker , Masahiro Yamada , Nathan Chancellor , Sami Tolvanen , Alexei Starovoitov , Nick Terrell , Chris Wilson , Vlastimil Babka , linux-arm-kernel@lists.infradead.org Subject: [PATCH printk v3 0/6] printk: remove safe buffers Date: Thu, 24 Jun 2021 13:17:42 +0206 Message-Id: <20210624111148.5190-1-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Here is v3 of a series to remove the safe buffers. v2 can be found here [0]. The safe buffers are no longer needed because messages can be stored directly into the log buffer from any context. However, the safe buffers also provided a form of recursion protection. For that reason, explicit recursion protection is implemented for this series. The safe buffers also implicitly provided serialization between multiple CPUs executing in NMI context. This was particularly necessary for the nmi_backtrace() output. This serializiation is now preserved by using the printk_cpu_lock. And finally, with the removal of the safe buffers, there is no need for extra NMI enter/exit tracking. So this is also removed (which includes removing config option CONFIG_PRINTK_NMI). Changes since v2: - Move irq disabling/enabling out of the console_lock_spinning_*() functions to simplify the patches keep the function prototypes simple. - Change printk_enter_irqsave()/printk_exit_irqrestore() to macros to allow a more common calling convention for irq flags. - Use the counter pointer from printk_enter_irqsave() in printk_exit_irqrestore() rather than fetching it again. This avoids any possible race conditions when printk's percpu flag is set. - Use the printk_cpu_lock to serialize banner and regs with the stack dump in nmi_cpu_backtrace(). John Ogness [0] https://lore.kernel.org/lkml/20210330153512.1182-1-john.ogness@linutronix.de John Ogness (6): lib/nmi_backtrace: explicitly serialize banner and regs printk: track/limit recursion printk: remove safe buffers printk: remove NMI tracking printk: convert @syslog_lock to mutex printk: syslog: close window between wait and read arch/arm/kernel/smp.c | 2 - arch/powerpc/kernel/traps.c | 1 - arch/powerpc/kernel/watchdog.c | 5 - arch/powerpc/kexec/crash.c | 3 - include/linux/hardirq.h | 2 - include/linux/printk.h | 22 -- init/Kconfig | 5 - kernel/kexec_core.c | 1 - kernel/panic.c | 3 - kernel/printk/internal.h | 23 --- kernel/printk/printk.c | 273 +++++++++++++++---------- kernel/printk/printk_safe.c | 361 +-------------------------------- kernel/trace/trace.c | 2 - lib/nmi_backtrace.c | 13 +- 14 files changed, 176 insertions(+), 540 deletions(-) base-commit: 48e72544d6f06daedbf1d9b14610be89dba67526 -- 2.20.1