🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #18791

[PATCH printk v3 0/7] Introduce policies for unsafe flushing

#18791
From: John Ogness
Date: Wed, 18 Nov 2026 23:03
90 lines
13484 bytes
v2 is here [0].

Until now unsafe flushing is only performed at the very end of
panic(), before entering the infinite loop. For other situations
(such as panic-kexec or panic-reboot or emergency-reboot) no
unsafe flushing is performed. The reasoning for this is because
an unsafe flush could lead to fireworks, which could prevent the
kexec or reboot from occurring.

However, some users may be willing to take on such risks in order
to see panic output. Indeed, for the netconsole (which does not
support safe atomic printing) it is a regression that such unsafe
printing does not occur. [1] 

This series adds unsafe flushing policy flags per-console to
allow individual consoles to perform unsafe flushing for such
scenarios. The unsafe flushing is hard-code-enabled for the
netconsole in patch 7/7. The justification is that this is not
less safe than the legacy netconsole.

Later these policy flags could be easily exposed to userspace
via /sys/class/consoles/, once the sysfs per-console interface
is available.

For this version I reduced the unsafe flush policies to the
minimum required by the netconsole: panic+restart and
emergency+restart. I also keep nbcon_atomic_flush_unsafe() and
use only this function for specifying the flush reasons. This
allows us to pinpoint where unsafe flushing is evaluated and,
as a nice bonus, to avoid all the legacy madness.

The first 4 patches have no functional changes. Hopefully they
are each small enough that a review is relatively trivial. The
functional changes (5-7) are also compact.

Changes since v2:

- Specify flush reason in nbcon_atomic_flush_unsafe() instead
  of console_flush_on_panic() and printk_trigger_flush(). This
  automatically avoids the need for any legacy handling.

- Remove KDB, PRINTK, NOTHREAD unsafe flush policies. (Not
  needed for now.)

- Add EMERGENCY_RESTART unsafe flush policy to be used for
  emergency_restart() when non-panic.

- Rename console.unsafe_flush_flags to
  console.allow_unsafe_policy.

- Change console_is_usable() to _never_ report
  CON_NBCON_ATOMIC_UNSAFE as usable.

- Introduce nbcon_is_unsafe_usable() as a variant to
  console_is_usable() to report CON_NBCON_ATOMIC_UNSAFE as
  usable. The caller decides if unsafe printing should occur.
  This is only used for nbcon+atomic flushing.

- Perform unsafe flush policy check higher up in
  __nbcon_atomic_flush_pending() instead of
  __nbcon_atomic_flush_pending_con().

John Ogness

[0] https://lore.kernel.org/lkml/20261111181942.593695-1-john.ogness@linutronix.de
[1] https://lore.kernel.org/lkml/20260915100140.3631650-1-ryan.roberts@arm.com

John Ogness (7):
  printk: Introduce and specify flush reasons
  printk: nbcon: Move unsafe takeover check to higher level
  printk: Move unsafe takeover check out of console_is_usable()
  printk: Use @reason instead of global variable to check flush policy
  console: Support unsafe flushing for panic/emergency restarts
  printk: Add unsafe flush points for panic+kexec and emergency_restart
  netconsole: Perform unsafe flushing on panic and emergency restart

 drivers/net/netconsole.c |  2 +
 include/linux/console.h  | 60 ++++++++++++++++++++------
 include/linux/printk.h   | 20 ++++++++-
 kernel/crash_core.c      |  1 +
 kernel/panic.c           |  2 +-
 kernel/printk/nbcon.c    | 91 +++++++++++++++++++++++++++-------------
 kernel/reboot.c          |  1 +
 7 files changed, 131 insertions(+), 46 deletions(-)


base-commit: ef19063ad84f8ed58ee44ebd49ba035fd5159e74
-- 
2.47.3
Technical Details
Message-ID: <20261118230345.808560-1-john.ogness@linutronix.de>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366494-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366494-linux-kernel-netdev=dewy.ru
From: john.ogness@linutronix.de (John Ogness)
Newsgroups: linux.kernel.netdev
Subject: [PATCH printk v3 0/7] Introduce policies for unsafe flushing
Date: Thu, 19 Nov 2026 00:09:36 +0106
Organization: Usenet Network
Message-ID: <20261118230345.808560-1-john.ogness@linutronix.de>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2723546"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:ahcg8uN5yinvyGZkQJRvRKi+Wfk= sha256:RpQKjMSdjwa37th/WGRvtn4CB3Mzr4OpLRGdB86kwDs=
	sha1:2j/kAX6/d8T8OyvrT6/h8AmP0gs= sha256:NYgd+jPhHgRv9cDut+rjw//M7qiqla60MnccJncABd0=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 2EA4B11540A; Thu, 19 Nov 2026 02:05:05 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.419
X-Spam-Status: No, score=-2.419 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	INVALID_DATE_TZ_ABSURD=0.632, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=linutronix.de header.b=GWTc4g5k; dkim=neutral
	reason="invalid (unsupported algorithm ed25519-sha256)"
	header.d=linutronix.de header.b=+hgwRrve
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id SLViiMl4Z28Z;
	Thu, 19 Nov 2026 02:04:58 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-366494-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linutronix.de
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id ED9BD1153E1; Thu, 19 Nov 2026 02:04:44 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 0B683182AF9; Wed, 18 Nov 2026 23:04:12 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795043035;
	b=hwDt8Y7mKckoICa/wHSkgL4CEYBkFZYO5FE8c1lgVl7RcXXy8OB2tWGgyKtp/q3IINqq
	 mMlqBCZYw8Mchs4GmQCGW0AxCp0uTHByudN0RM9Mo97I5MovLqGZU6u/nJTD5xbD4gWC1
	 tbwJmG9bparOkUucEGzrSt37AvDFqJgusI8s9ZxOtsSLF79P+jqkPEuBAwD1P1UmZWtUW
	 8kcOrmMoimzJu/sLRusfGWvNZarxIXRuNqDnKKaxV7JwLXMa4Z6pY6uSFYNtH5eNpM40E
	 CtBGCQfpJCPCgfGu/oYQ/zYDurieUEfbYd+wIe6I3r/xXeXUhsukznvjNhfYKrgRxfw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795043035;
	h=X-Original-To:Received:DMARC-Filter:From:DKIM-Signature:
	 DKIM-Signature:To:Cc:Subject:Date:Message-ID:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:Content-Transfer-Encoding;
	bh=leI1FFs3wJSFLMy2XFplwoNsj0EC2A+qYx8KybwPYGI=;
	b=lIPamQzXdSePAtbtx9+LB3S0Zq0EJCbnOF29pGdUquuhUeCilxyNbxkcjJLGrfubs2qC
	 gnp9ITZt9UmDg8nXRlRt5ATc9LdHDkq7QCzebBDJJZ1DDJ7/nredjIvIFdH5MpJB+vuBl
	 XObYcWuUT9vyQTBEx9/1NRrDGFJxk2wCrEIeB+tsQeWrhYXtbiBk/tHtwVB/KHblE8ak4
	 bntYUx0A7pDMnqtypN0UnXZal5pizgod7XT3iv3oqtR+iqPGpPRT4UPmZlv3X/LkxDPLw
	 Vq0IyGEwWYFkSp4aMVs0IOOqMhsiTD5nnglmiyCpvgljljrdMtF66dPAmKQXcE4Wewg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=GWTc4g5k;
	dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=+hgwRrve;
	dmarc=pass header.from=linutronix.de;
	spf=pass smtp.mailfrom=linutronix.de;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 3FAF060A3838;
	Wed, 18 Nov 2026 23:03:55 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=GWTc4g5k;
	dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=+hgwRrve
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=193.142.43.55
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795043029;
	b=yhg9oEIpdmtPI7h76Fni1v9gPIN6zaKZm7LjhS91MWvE4TkVGyj8VSArz2lH4eFIxqUe
	 +HboxcwmzdR2vAJIWuzs/n5ZxoLraHzGjOD/5DsQYQeWC3lFy1BRqzktWTNfSoni0FQzv
	 1eX6i/gRVLCMSUuqy3ywFGaBwsDT3sAmDPFCXjiEBlf1rPXAWLTbTDrresp/rH9/Wis8o
	 pDPnWZxSNqkOJTxmw2yA6p9daf5wqT6Ijsmx/csQpLcWlhTIXrR1SToak5CpFvf0lKSkk
	 nJKq4YXwu/g8kuQtvGQhd/ISABs8hiVcZ0bJcBoWyVgyXz1d40D3s7Cb3G0NDtwqwQw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795043029;
	h=DMARC-Filter:From:DKIM-Signature:DKIM-Signature:To:Cc:Subject:Date:
	 Message-ID:MIME-Version:Content-Transfer-Encoding;
	bh=leI1FFs3wJSFLMy2XFplwoNsj0EC2A+qYx8KybwPYGI=;
	b=honddvYe9n2pjEv473vljkeRhkfsCFEX+2KOZBDP+vZfiRfnGe0l9HrgvYF2HRYS/BfB
	 tWPp84FVieqH7Pfc19EU9q5rDOo52dCzryBSnecDq7og1iTdWUWXTtbgf5BKFNeYgwpYt
	 4ZApz0UbbvZ4cSphmovPC0IcWwTJuwOAliH0yTw6s29Xo730drLDeWpS/E2c0+U71fb/F
	 QqZY9LUJJh+2RT5iNDOcyF5gyen3aPF6ZJ5lbZ5ZgDaS/Fg7h2HzAODoLWC8gbJRq+sOD
	 xcYUqV6Kvihtb5VkNKTa6oUuxVhvYm6psEJY0zjf/31DVyVPQZZsG+vCCYsGwEEz77w==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=linutronix.de;
	spf=pass smtp.mailfrom=linutronix.de;
	dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=GWTc4g5k;
	dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=+hgwRrve;
	arc=none smtp.remote-ip=193.142.43.55
X-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 ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id D30B0606A32C;
	Wed, 18 Nov 2026 23:03:48 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D30B0606A32C
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de;
	s=2020; t=1795043026;
	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=leI1FFs3wJSFLMy2XFplwoNsj0EC2A+qYx8KybwPYGI=;
	b=GWTc4g5krJCo/IU3KT4WlFaHCvB8m9M/xw8MeC2cfC1s0cjtUbe5NG8yILU83QC6s3imyx
	/8HCRV9PridoX7WomHLKgFCtV1ZhW5SqYGViN7lYoeOMNFVZQHT92dgzxDbex6gtpTgG4a
	nyObo8wXZsFCBM9Bz0kH7PIW0f1W2bstVPEuznhefzIIViRWPsaffS0ph4Bpppb7Htrg1C
	v/qIrjOKuWGvYqaODtam8QY5oilpxz7PJo93yQSajnFeVtnA9yce5gG9NZS8Za1ZwiB39o
	QCHIumEOh3jg9FvOPWOihVHGNY97xfWeuWe8/jk5+x3Gkee5XUk75Ouu7o8G1A==
X-DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de;
	s=2020e; t=1795043026;
	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=leI1FFs3wJSFLMy2XFplwoNsj0EC2A+qYx8KybwPYGI=;
	b=+hgwRrveBfg7slz3C4Vs75suxSJVdS1shAjY/DRaX0xP4hfUqwuXZ3KAMpp7efAl3obEwA
	aK+OVSrV3WC8w2AQ==
X-Cc: Sergey Senozhatsky <senozhatsky@chromium.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ryan Roberts <ryan.roberts@arm.com>,
	Breno Leitao <leitao@debian.org>,
	printk@lists.linux.dev,
	linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Rio <rioo.tsukatsukii@gmail.com>,
	Danilo Krummrich <dakr@kernel.org>,
	Aaron Tomlin <atomlin@atomlin.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Alessandro Carminati <acarmina@redhat.com>,
	Pnina Feder <pnina.feder@mobileye.com>,
	Gal Pressman <gal@nvidia.com>,
	Baoquan He <baoquan.he@linux.dev>,
	Mike Rapoport <rppt@kernel.org>,
	Pasha Tatashin <pasha.tatashin@soleen.com>,
	Pratyush Yadav <pratyush@kernel.org>,
	Dave Young <ruirui.yang@linux.dev>,
	Bradley Morgan <include@grrlz.net>,
	Oleg Nesterov <oleg@redhat.com>,
	Pavel Tikhomirov <ptikhomirov@virtuozzo.com>,
	Petr Pavlu <petr.pavlu@suse.com>,
	"Cen Zhang (Microsoft)" <blbllhy@gmail.com>,
	kexec@lists.infradead.org,
	Gustavo Luiz Duarte <gustavold@gmail.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list