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

From: Petr Mladek

Date: Mon Oct 26 2026 - 10:58:50 EST


On Mon 2026-10-26 14:15:49, John Ogness wrote:
> On 2026-10-26, Breno Leitao <leitao@xxxxxxxxxx> wrote:
> >> In the per-console loglevel series Chris Down introduces [2]
> >> /sys/class/console/ to sysfs. This is where we would put all the
> >> upcoming per-console knobs. I would expect a replay trigger would fit
> >> well there.
> >
> > That makes sense from a design perspective. Thanks for the direction.
> >
> > So the next step would be to add a basic /sys/class/console/, similar to
> > [2], and put a `revplay` entry in it.
> >
> >
> > That would be about three patches:
> >
> > 1. Create /sys/class/console/, similar to [2] but without any loglevel
> > handling. cdown can build on it when respinning the loglevel series.
> > 2. Add the per-console replay helper, similar to [3].
> > 3. Add the first entry (/sys/class/console/replay), which triggers the
> > helper from patch 2.
> >
> > Is that what you have in mind?

Sounds good to me.

> Yes. But perhaps someone else wants to provide some feedback about this?

The "replay" approach looks like a big hammer. Many messages might get
duplicated, especially when the outage was small.

A better solution might be to do not increment con->nbcon_seq
when the transmission failed. And try it later again.

con->write_thread() currently does not return anything. I believe that
it is partly a historical limit. Two problems come to my mind:

1. There used to be a global "console_seq" counter which was common
for all console drivers. But we have a per-console counter since
the commit a699449bb13b70b8bd1 ("printk: refactor and rework
printing logic").

2. There has never been a try-later logic. But is should be easier
to add it now. We have the kthreads. And even the legacy loop
is able to break when there is not progress.

Best regards,
Petr


> >> [2] https://lore.kernel.org/lkml/84b8d91693e56f6026271bc40553bcb6657ab24d.1764272407.git.chris@xxxxxxxxxxxxxx/gy
> >
> > [3] https://lore.kernel.org/all/20261024-netcons-replay-upstream-v1-1-9613f38496e5@xxxxxxxxx/