All of lore.kernel.org
 help / color / mirror / Atom feed
From: Breno Leitao <leitao@debian.org>
To: Petr Mladek <pmladek@suse.com>
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
Subject: Re: [PATCH RFC 0/2] netconsole: allow replaying the printk buffer on demand
Date: Tue, 27 Oct 2026 08:54:12 -0700	[thread overview]
Message-ID: <auDETo3ot3enCEv_@gmail.com> (raw)
In-Reply-To: <auCraiuMZApQHiNA@pathway.suse.cz>

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

  reply	other threads:[~2026-10-27 15:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-24 23:06 [PATCH RFC 0/2] netconsole: allow replaying the printk buffer on demand Sam Crossley
2026-10-24 23:06 ` [PATCH RFC 1/2] printk: add per-console replay helper Sam Crossley
2026-10-24 23:06 ` [PATCH RFC 2/2] netconsole: add configfs trigger to replay printk buffer Sam Crossley
2026-10-26  9:34 ` [PATCH RFC 0/2] netconsole: allow replaying the printk buffer on demand John Ogness
2026-10-26 11:44   ` Breno Leitao
2026-10-26 13:09     ` John Ogness
2026-10-26 14:58       ` Petr Mladek
2026-10-26 16:33         ` John Ogness
2026-10-26 17:49           ` Breno Leitao
2026-10-27 13:47             ` Petr Mladek
2026-10-27 15:54               ` Breno Leitao [this message]
2026-10-27 17:45                 ` Petr Mladek
2026-10-27 12:58           ` Petr Mladek
2026-10-26 14:39     ` Chris Down
2026-10-26 15:32       ` Breno Leitao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=auDETo3ot3enCEv_@gmail.com \
    --to=leitao@debian.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=chris@chrisdown.name \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=john.ogness@linutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pmladek@suse.com \
    --cc=rdunlap@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=samuelcrossley@gmail.com \
    --cc=senozhatsky@chromium.org \
    --cc=skhan@linuxfoundation.org \
    --cc=tglx@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.