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 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=-8.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, INVALID_DATE_TZ_ABSURD,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 B2EECC48BDF for ; Thu, 24 Jun 2021 11:20:02 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 32568613B3 for ; Thu, 24 Jun 2021 11:20:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 32568613B3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linutronix.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4G9d2n4Knzz3bv7 for ; Thu, 24 Jun 2021 21:20:01 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=IHgUrWjq; dkim=fail reason="signature verification failed" header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=UgtDgR4w; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linutronix.de (client-ip=193.142.43.55; helo=galois.linutronix.de; envelope-from=john.ogness@linutronix.de; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=IHgUrWjq; dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=UgtDgR4w; dkim-atps=neutral X-Greylist: delayed 450 seconds by postgrey-1.36 at boromir; Thu, 24 Jun 2021 21:19:26 AEST Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4G9d2605tSz3bvZ for ; Thu, 24 Jun 2021 21:19:25 +1000 (AEST) 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 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 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexey Kardashevskiy , Alexei Starovoitov , Chris Wilson , "Wolfram Sang \(Renesas\)" , Paul Mackerras , Tiezhu Yang , Marc Zyngier , Masahiro Yamada , Russell King , Peter Zijlstra , Yue Hu , Ingo Molnar , linux-arm-kernel@lists.infradead.org, Sami Tolvanen , Valentin Schneider , Kees Cook , "Paul E. McKenney" , Anshuman Khandual , Frederic Weisbecker , Nicholas Piggin , Nathan Chancellor , Nick Terrell , Steven Rostedt , Thomas Gleixner , Vlastimil Babka , kexec@lists.infradead.org, linux-kernel@vger.kernel.org, Pekka Enberg , Sergey Senozhatsky , Eric Biederman , Andrew Morton , linuxppc-dev@lists.ozlabs.org, Mike Rapoport , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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 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=-8.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, INVALID_DATE_TZ_ABSURD,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=unavailable 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 83879C48BDF for ; Thu, 24 Jun 2021 11:14:10 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5557C613B1 for ; Thu, 24 Jun 2021 11:14:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5557C613B1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=e/a6xFyevz3PIbiUMcnKbz/nsVn4eSgdNZQ+GwJMRSU=; b=tPkSX6FV2Gx0RO z2v3vdH2yBKR9Dyii/zZZs2goUpN2pEr/+6YaIVcspV4wb6rACKNKJFdOuARH20fbC2yIrhvkunj8 hcjDCo2NxTtkBRDBLLm5EhS0IKNn4Vfa1Q9+o9Y17S/tao1JFhjn+NWgRDZ7wyfBdX3Qus3yOqoUo X+xrV3TPozhzJ9cJCykAnx0D0aBCDO96xLgNRupfXLXXSv7loV4nvWYUSDTBvdCfGVvLPyk/9svU1 3a99BWyTNQqygK4rOhAUB8kruZi35mkeOgBw+p/ofh2upbMcLYf5e6neSMD+zUTU5BDX+4OlHSMaE hcYq8mA4OxGXRPZGxy9g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwNHG-00EKE4-3i; Thu, 24 Jun 2021 11:12:10 +0000 Received: from galois.linutronix.de ([193.142.43.55]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwNH9-00EK6P-51; Thu, 24 Jun 2021 11:12:04 +0000 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210624_041203_368759_26A05490 X-CRM114-Status: GOOD ( 11.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: From: John Ogness 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 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "kexec" Errors-To: kexec-bounces+dwmw2=infradead.org@lists.infradead.org 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 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 _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec