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

From: Sam Crossley

Date: Sat Oct 24 2026 - 19:06:38 EST


leitao and tglx had discussed this at LPC, sending RFC as suggested
by Breno Leitao.

Netconsole only forwards records while an enabled target and its
transport are available. A target enabled after boot, or one that was
unreachable during a network outage, leaves a gap in the remote log that
cannot currently be recovered.

This adds a write-only "replay" attribute to the netconsole configfs
subsystem that rewinds the netconsole consoles so the retained ring is
re-sent. Patch 1 adds the printk helper; patch 2 is its only caller.

The replay is best effort. console_try_replay() uses console_trylock(),
so unrelated console activity can silently skip the replay.

Testing: verified in a VM and on a physical host (the latter rebased on
a 7.1 kernel) that records emitted before any target was enabled are
re-sent on trigger.

---
Sam Crossley (2):
printk: add per-console replay helper
netconsole: add configfs trigger to replay printk buffer

Documentation/networking/netconsole.rst | 14 ++++++-
drivers/net/netconsole.c | 25 ++++++++++++
include/linux/printk.h | 6 +++
kernel/printk/printk.c | 67 ++++++++++++++++++++++++---------
4 files changed, 94 insertions(+), 18 deletions(-)
---
base-commit: 00513fc3d6c467b1ef3c101a2943cb92de25c49a
change-id: 20260926-netcons-replay-upstream-189eec0b4c79

Best regards,
--
Sam Crossley <samuelcrossley@xxxxxxxxx>