🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #7977

Re: [PATCH RFC 0/2] netconsole: allow replaying the printk buffer on demand

#7977
From: Breno Leitao
Date: Tue, 27 Oct 2026 15:54
65 lines
11922 bytes
On Tue, Oct 27, 2026 at 02:47:22PM +0100, Petr Mladek wrote:
> On Mon 2026-10-26 10:49:32, Breno Leitao wrote:
> > A bit of context on the use case from our side.
> > 
> > In an ideal world netconsole is enabled from early boot through the
> > kernel command line, but in some case this is impossible
> > (linux as bootloaders - ipxe/sd-stubs/etc).
> > 
> > The other way to setup netconsole is to create a new target at runtime
> > through configfs. Netconsole then only sends messages from the time the
> > target is enabled.
> > 
> > For this second case, I would like to replay the whole kernel log on
> > netconsole, such as previous messages. Something might have happened
> > before the target was enabled, and we want visibility into that.
> 
> Just to be sure that I understand it correctly. 
> 
> Is the netconsole registered before it gets functional, please?

Correct. The console is registered at module load time, in
init_netconsole(), before any target is created.

In other words, a single console is registered at module load, and the
netconsole targets are then handled under that same console.

> Is it possible to detect that the netconsole is not yet functional
> and when it could start working?
>
> I ask because there is the flag CON_PRINTBUFFER which should cause
> re-playing all messages on the console during registration.
> 
> A solution might be to delay the console registration until
> the netwok target is really working.

Yes, we can register the console when the target is enabled. However, I
think the user will need to choose whether the console is registered
with CON_PRINTBUFFER or not, since in some cases they only want messages
from the moment the target is enabled.

So we would probably need one console per netconsole target?

> Another solution might be to temporary block/disable the console
> until it gets operational. We already have console_suspend()/resume()
> API. But we might need something new to distinguish it from
> the system suspend/resume handling.

In that case, what happens to the console while it is suspended?

> > That said, the "per-console counter" might work as well, since it would
> > start as 0, thus, we know that netconsole target would be behind, and
> > try to replay? (not sure how yet)
> 
> This is what the console_try_replay_all() does. The only difference
> is that it resets the counter to the oldest available message,
> see __console_rewind_all(). It is just a small optimization
> when the ring buffer is already full and the oldest messages
> are gone.

Right, but that would apply to all consoles, while in our case we only
want to replay the log on a specific console (netconsole).

Thanks for the suggestions,
--breno
Technical Details
Message-ID: <auDETo3ot3enCEv_@gmail.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-352535-linux-kernel-netdev=dewy.ru
References: <20261024-netcons-replay-upstream-v1-0-9613f38496e5@gmail.com> <87fqxskdpl.fsf@jogness.linutronix.de> <at84qygscue8crQi@gmail.com> <87a4o0k3qa.fsf@jogness.linutronix.de> <at9qgBucVm-QHnye@pathway.suse.cz> <87zew0ifpp.fsf@jogness.linutronix.de> <at-Ppa86sBw7mO8W@gmail.com> <auCraiuMZApQHiNA@pathway.suse.cz>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-352535-linux-kernel-netdev=dewy.ru
From: leitao@debian.org (Breno Leitao)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH RFC 0/2] netconsole: allow replaying the printk buffer on
 demand
Date: Tue, 27 Oct 2026 08:54:12 -0700
Organization: Usenet Network
Message-ID: <auDETo3ot3enCEv_@gmail.com>
References: <20261024-netcons-replay-upstream-v1-0-9613f38496e5@gmail.com>
 <87fqxskdpl.fsf@jogness.linutronix.de>
 <at84qygscue8crQi@gmail.com>
 <87a4o0k3qa.fsf@jogness.linutronix.de>
 <at9qgBucVm-QHnye@pathway.suse.cz>
 <87zew0ifpp.fsf@jogness.linutronix.de>
 <at-Ppa86sBw7mO8W@gmail.com>
 <auCraiuMZApQHiNA@pathway.suse.cz>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="1577062"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:EA+d7cZV8zP0jnjRC3ZWrHvOkKs= sha256:6n3FeajhVyaOYTRuG3OHqCgQqb859JIqlE+35xofg3s=
	sha1:246aJ2Jdj4yA2pQBjR/z9MLQ0iU= sha256:W0s8cE8HueIBZCLVK4k7B2zDzMIRpL3x0Jo6LNCPfgo=
Content-Disposition: inline
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 85713125C0B; Tue, 27 Oct 2026 19:10:50 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.051
X-Spam-Status: No, score=-3.051 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	HEADER_FROM_DIFFERENT_DOMAINS=0.25, 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=debian.org
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 MpCNmCKERlHY;
	Tue, 27 Oct 2026 19:10:45 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-352535-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=debian.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 16B96125C09; Tue, 27 Oct 2026 19:10:31 +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 152BA35B14; Tue, 27 Oct 2026 15:55:01 +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=1793116491;
	b=lZnKTJXNxjJ44JVosGrWnfJndicbYsWX35XGGMks6bnPGRCgPDChdwjJkEHcMp44du8q
	 dKd4Ye+uecjjKJSfs8S9mE5JfkrsCzF5RzV0G4OJqaZs+oiWeA1ZK/Usic53KnQsc7rnr
	 YI87RuuIThMzSB2qgiKM/Lhs0EfmgAY0ncpvvuPqUKiqSCDrWGF5tvpxLLNNNjQHX8bpb
	 ++AoOKW3AS7cgPBnO3rI2I0zngK5cPcQut8wts/s6L9BuwfkSLrj4CLpDdRFJJEzmf5Rk
	 ccsTzpWJhWNMyZZAJnLwwu0Uac0qpOnNKGrDteNHEHhY45ZD7XQhSUNFl9pzf0NodTQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793116491;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:Date:
	 From:To:Cc:Subject:Message-ID:References:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:
	 X-Debian-User;
	bh=9d7CkpNkhFpT/p+mmFEwEMDe8MN5hlU8W6VraSeQEx0=;
	b=k9k4sk/4Ch4BsOADbZb7CjWBtNFOpKeCDe7iKEGNi/yKMZAD13QdjfOz/Q2Z5S++iOpd
	 K+r7kuVrGYfurrIT9sUo6p6DruUfpw/7vLoM+y7MxEoGlyabl6qt5SkSZdvRvQ80qD928
	 EaRpYe9V5kq2S5s51yE3Me4QTqgspaZDMuovmFealxXKfXnSobtLMlWXseiG9nV3OGurP
	 nGd8wy/MhKRcO3T/c9FtPPt+sR4QSoWJXoPNTm3MaJ56VE/LuV+8l0FtiZMrPi5BxLgMH
	 syW3jcHgK5jH6KKKZ9sXawmKDicX7HN2YM/h3OUWRKBjuIZ0pdMBK/O8LXFsgQa5kLg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=debian.org header.i=@debian.org header.a=rsa-sha256 header.s=smtpauto.stravinsky header.b=hsgL9t6N;
	dmarc=pass header.from=debian.org;
	spf=pass smtp.mailfrom=debian.org;
	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 F0D99606A32A;
	Tue, 27 Oct 2026 15:54:50 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=debian.org header.i=@debian.org header.a=rsa-sha256 header.s=smtpauto.stravinsky header.b=hsgL9t6N
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=82.195.75.108
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793116485;
	b=AyOsv7aeOTG2gpKtnzS1UHyd4xsDDyTOrAoAVaMkL7+QrQfYwfWAGI/g0bkIyxmFdXhe
	 LZbS+BcS2b241g+t5x4vdQGZBCQ1+BOoovsHS6uKeNjWlCa9gZlZtfCFIu5CJuFOrQgE9
	 /nqpqXPvqZ3Du86Hm25RBx1JkuyTjXQtmK+0j70mMjlGmxOACDSJ1sYD6FDsGxAvRtw1b
	 bUkdyKPb2LCqF7dR3Nc9olt8sdzRIipPnQteEUux6zEuJdxwwMK+mf1s1OZ2ysNG//aon
	 A67FIFrc3IIvfdv3tLFhpXo+UBYfbqHNbOztRhEITYjkhxzLceSYhZouJZmu4BMdCVQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793116485;
	h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject:
	 Message-ID:References:MIME-Version:Content-Type:Content-Disposition:
	 In-Reply-To:X-Debian-User;
	bh=9d7CkpNkhFpT/p+mmFEwEMDe8MN5hlU8W6VraSeQEx0=;
	b=JpfPJp6CR+pZNykqGFp+fZyBtrDBEbiIcMxNwDoWTDLQ0Et5hOGx5FM2tCckSH+CNrTg
	 CqXetq0bGv7Huy1Dt8zUCavUgWulb5LMLedrnCFFWjgH27hZJbOK451KT2FAQB0EbN3+s
	 9Qx8JEm6/Ykx8n8uke1Z5Chsms9Mkhv14+ziEWgi/Lx6EMYUL0cgn3qqMy4MpUZQw2A7z
	 QFCdeP+rdGWScC1MCQU1RXrIDQIxGhVmxhHWBSfx/833AeHdJRGPKvp7dm7RFsGckQgm+
	 2TC30w4Wi7OPvk6dFAfHycGlR8hVivzOs329mRqtQHQyhOhI/knStO2tNYZTdVUgEOg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=debian.org;
	spf=pass smtp.mailfrom=debian.org;
	dkim=pass header.d=debian.org header.i=@debian.org header.a=rsa-sha256 header.s=smtpauto.stravinsky header.b=hsgL9t6N;
	arc=none smtp.remote-ip=82.195.75.108
X-Received: from stravinsky.debian.org (stravinsky.debian.org [82.195.75.108])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A7AD60A2607;
	Tue, 27 Oct 2026 15:54:44 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7A7AD60A2607
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=debian.org
X-DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org;
	s=smtpauto.stravinsky; h=X-Debian-User:In-Reply-To:Content-Type:MIME-Version:
	References:Message-ID:Subject:Cc:To:From:Date:Reply-To:
	Content-Transfer-Encoding:Content-ID:Content-Description;
	bh=9d7CkpNkhFpT/p+mmFEwEMDe8MN5hlU8W6VraSeQEx0=; b=hsgL9t6N4NhDBmPcr0pHNiHWGU
	rugR3grg+segcnbDlY8Ttg8+hOmVAXacTi3pd5BTJITtyGaz7mCCRMdmzQey5cRAmNO+oRSWZGMqV
	1MknRS/jVF8Q9ae8fUviHfvlXwPGwE0XBlGyqKSEp5Gb+9Vm4nNAvDLlZ8alDJzv1q/7gWgUynb16
	QESxLhOjLy4P1tQ0gEOGrR4zqfXR7pk42lYXSP+Tqei90/L4T1GAenv9nVFJvqnCbrZiIWlmmAW/x
	cvYBjgdjZMWRxjff8541P7q/s1vUVNA+AATftGnzcwkXFjSz5w935VtO4/E3ZAWoNy1b2OO1cnOFX
	hLD+ZF6A==;
X-Received: from authenticated-user
	by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256)
	(Exim 4.96)
	(envelope-from <leitao@debian.org>)
	id 1xLjVC-001ZUC-1F;
	Tue, 27 Oct 2026 15:54:18 +0000
X-Cc: John Ogness <john.ogness@linutronix.de>, chris@chrisdown.name, 
	Sam Crossley <samuelcrossley@gmail.com>, Thomas Gleixner <tglx@kernel.org>, 
	Andrew Lunn <andrew+netdev@lunn.ch>, "David S. Miller" <davem@davemloft.net>, 
	Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, 
	Jonathan Corbet <corbet@lwn.net>, Paolo Abeni <pabeni@redhat.com>, 
	Randy Dunlap <rdunlap@infradead.org>, Sergey Senozhatsky <senozhatsky@chromium.org>, 
	Shuah Khan <skhan@linuxfoundation.org>, Simon Horman <horms@kernel.org>, 
	Steven Rostedt <rostedt@goodmis.org>, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, 
	linux-doc@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
X-In-Reply-To: <auCraiuMZApQHiNA@pathway.suse.cz>
X-Debian-User: leitao