Article View: linux.kernel.netdev
Article #7120[PATCH RFC 2/2] netconsole: add configfs trigger to replay printk buffer
From: Sam Crossley
Date: Sat, 24 Oct 2026 23:06
Date: Sat, 24 Oct 2026 23:06
96 lines
14258 bytes
14258 bytes
Netconsole only forwards records while an enabled target and its transport
are available, so enabling a target after startup, or recovering from an
outage, leaves a gap in the remote log.
Add a write-only replay attribute at /sys/kernel/config/netconsole.
Writing 1 rewinds the basic and extended netconsole consoles to the oldest
retained record and queues the records for transmission. Other registered
consoles are unaffected. Records keep their original printk timestamp and,
in extended format, their sequence number, so a receiver can deduplicate
what it already had.
Replay is best effort and asynchronous.
Note that "replay" is now an attribute in the netconsole configfs
directory, so it can no longer be used as a target name.
Signed-off-by: Sam Crossley <samuelcrossley@gmail.com>
---
Documentation/networking/netconsole.rst | 14 +++++++++++++-
drivers/net/netconsole.c | 25 +++++++++++++++++++++++++
2 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/Documentation/networking/netconsole.rst b/Documentation/networking/netconsole.rst
index 4ab5d7b05cf10..2e489dd64ba42 100644
--- a/Documentation/networking/netconsole.rst
+++ b/Documentation/networking/netconsole.rst
@@ -111,7 +111,8 @@ netconsole module (or kernel, if netconsole is built-in).
Some examples follow (where configfs is mounted at the /sys/kernel/config
mountpoint).
-To add a remote logging target (target names can be arbitrary)::
+To add a remote logging target (target names can be arbitrary, except
+"replay", which is used by the attribute below)::
cd /sys/kernel/config/netconsole/
mkdir target1
@@ -125,6 +126,17 @@ To remove a target::
rmdir /sys/kernel/config/netconsole/othertarget/
+To replay the records retained in the kernel printk ring buffer to the enabled
+netconsole targets::
+
+ echo 1 > /sys/kernel/config/netconsole/replay
+
+As during normal operation, records above the current console loglevel are not
+sent. The replay is best effort and asynchronous: the write returns once the
+consoles have been rewound, before the records have been transmitted, and a
+console whose lock cannot be acquired is skipped. Only netconsole output is
+replayed; other registered consoles are unaffected.
+
The interface exposes these parameters of a netconsole target to userspace:
=============== ================================= ============
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index b358e5c367351..f527a5ee45662 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -1830,8 +1830,33 @@ static const struct configfs_group_operations netconsole_subsys_group_ops = {
.drop_item = drop_netconsole_target,
};
+static ssize_t replay_store(struct config_item *item, const char *buf,
+ size_t count)
+{
+ bool replay;
+ int ret;
+
+ ret = kstrtobool(buf, &replay);
+ if (ret)
+ return ret;
+ if (!replay)
+ return -EINVAL;
+
+ console_try_replay(&netconsole);
+ console_try_replay(&netconsole_ext);
+
+ return count;
+}
+CONFIGFS_ATTR_WO(, replay);
+
+static struct configfs_attribute *netconsole_subsys_attrs[] = {
+ &attr_replay,
+ NULL,
+};
+
static const struct config_item_type netconsole_subsys_type = {
.ct_group_ops = &netconsole_subsys_group_ops,
+ .ct_attrs = netconsole_subsys_attrs,
.ct_owner = THIS_MODULE,
};
--
2.53.0-Meta
Technical Details
Message-ID:
<20261024-netcons-replay-upstream-v1-2-9613f38496e5@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-351457-linux-kernel-netdev=dewy.ruReferences:
<20261024-netcons-replay-upstream-v1-0-9613f38496e5@gmail.com>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-351457-linux-kernel-netdev=dewy.ru
From: samuelcrossley@gmail.com (Sam Crossley)
Newsgroups: linux.kernel.netdev
Subject: [PATCH RFC 2/2] netconsole: add configfs trigger to replay printk
buffer
Date: Sat, 24 Oct 2026 16:06:04 -0700
Organization: Usenet Network
Message-ID: <20261024-netcons-replay-upstream-v1-2-9613f38496e5@gmail.com>
References: <20261024-netcons-replay-upstream-v1-0-9613f38496e5@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
logging-data="886304"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:kRObk9aJtTC374siHy2M5AhHTZk= sha256:7xi2OFedGa4+W3txLvwTuxBH4NB8MtmJg0mCQD7IXCQ=
sha1:15XPNYUlbeRbRDL+txhklxetHyI= sha256:yS0dudRMTyOg+VV23T+q1/dL4Ai5NytnfL62vnXEBv0=
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 493591116BB; Sun, 25 Oct 2026 02:08:12 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.048
X-Spam-Status: No, score=-3.048 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, FREEMAIL_FORGED_FROMDOMAIN=0.001,
FREEMAIL_FROM=0.001, 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=gmail.com
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 lMZt0MdpCUvL;
Sun, 25 Oct 2026 02:08:09 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-351457-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id CA67F11003C; Sun, 25 Oct 2026 02:08:00 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sea.lore.kernel.org (Postfix) with ESMTP id 2E72E327D9; Sat, 24 Oct 2026 23:07:08 +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=1792883227;
b=McoOfdQpluvdjEwOS+64q1X7nodTBr7IMIlCoCPEugrQepFTjqshjOTyasCcWMAjY2+G
898+aYDMK6Z/VP8c8fLu0ARCARkmGws7hmkdUGLLtMXzkBCQWT9hsHIsRYlHmO878kEn1
GMze29S8X2fsJNrB3uiv0I+tsjHHd2Rl1CqSwCu7sMw1wciN81UgTEMJvrahVYfFOcw4m
k93epYTEByFcGubP/nPcJkByg8KE0W8sd60BHXfKZljXnHJDgE3hA+CRaJgX4vZOy5DEa
Kf0WO7raaO+1gFj9FUpsP4kbG/f8akdOh1d+qPF01XtGUDENPe05q46jIfguS84AqFA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1792883227;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
X-Gm-Gg:X-Received:Received:From:Date:Subject:X-Mailing-List:List-Id:
List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
Precedence:MIME-Version:Content-Type:Content-Transfer-Encoding:
Message-Id:References:In-Reply-To:To:Cc:X-Mailer;
bh=ilKVSD9FJbr4rCgUq3aZ7XRBwC0roP+y+YvlkpAT2Pw=;
b=upDZHVZNZpJNN9qgYVYAqhgiFnXpI0veaKgoBNyOe0YMMzUc6exMLSYvi/dhMzPxrBNA
VBK/juJbrpbD57KlJNL4zwz/fRlTtkGtEn5/Inta+7xaCTpd5s8ymdYa7PWZxo4TH7obb
1edYBpco5Qzb+CmVtPfycQkoDVsEAfxEhvhWRMzZrWXx/lf9ICGe0AiQ139MCDh63Wdpm
LD/5Az0OGkxxul0nIe0U8lH4zUXGv+OssRtomg/SMR6cGUol0ntXcrnpDMSgleTeU5eTC
JEVq+KU2qqeLefzpaTAbIdUkgx334hehMguBtRhQASFc84yZd1G1qHxLZ6O2zsVHB9w==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=N9WzVPxB;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
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 D1A16606A32F;
Sat, 24 Oct 2026 23:07:07 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=N9WzVPxB
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.218.47
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1792883227;
b=HBM1wH35VnW2EJGyl10A7OBc4ctdey1PKUZ2uYtIG7CvVpWBHdL60U1nYOmCSQo7jboM
ENzTPfK64NmX2oH09t/h5ThYsfOzns6i00v6m1enxm8AMDObFOL2IsKlCxGtR8FcOUOAw
qsHbnZuRmhRMXG+0UL/D5TMEl65mjzpiZfXGbdQhNMJ2rSBOYadF4vXDSoF6fNgLrxeJ2
LgSjllX7TOf2HdGzGVoQ2tqfyh2qGM8KosuJ3aQ9LuCm7/WfPFioKQTZRUluwoR+j60sK
DEK9sVyqno9uOb0QeU7vc77iDup2qA7mzlWUN4kAwopCg1Ru0aKBjzHKkje9KIKwixA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1792883227;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
From:Date:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:
Message-Id:References:In-Reply-To:To:Cc:X-Mailer;
bh=ilKVSD9FJbr4rCgUq3aZ7XRBwC0roP+y+YvlkpAT2Pw=;
b=gtO7/nBInZUlmUxslCblEQ/kizPjjRgdUBQRsyFe+6rICl15+dptiyM+aGgd4zB1bapW
IvEaLXYblzyEk64eQRyzf2cKIvYK984Xi2BJhc4FaQPTZkEnWj7Ixj798KTRwXQvIj4jU
aWTN6vnqGXdSlpjsNlXVmkMDrUngxvGn0AaG0IWhTyTAlQlg2muIEUVmJfqBfh4wgrJsi
wvWdqP9Iyu5iPwAOtJ42DdVfFzX2EC6VLtBj8xL8yEhfrl1jN8/+zXNOuZFF50D44/5Ef
/P2tqNvLdKjZHgxcuSgSzKLnxWVTRlpI/MIB8YDHzie94OPCwL7IzYyMco5hia+Rq1g==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=N9WzVPxB;
arc=none smtp.remote-ip=209.85.218.47
X-Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id A79C0606A31D
for <netdev@vger.kernel.org>; Sat, 24 Oct 2026 23:07:06 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A79C0606A31D
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-c45551fa84eso286698166b.3
for <netdev@vger.kernel.org>; Sat, 24 Oct 2026 16:07:06 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20251104; t=1792883225; x=1793488025; darn=vger.kernel.org;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:content-type:mime-version:subject:date:from:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=ilKVSD9FJbr4rCgUq3aZ7XRBwC0roP+y+YvlkpAT2Pw=;
b=N9WzVPxBXctumTp0wOXBruzh3pYlSuW0il9yspz22fQ8bBM7aLv/Kv50Oss6qBHO4c
pXD6s9Y6qS362JkZKTQTIc0Of6sF0AW5/JQPYcTs3L4YjuRLmKvUZT2st1Urfw+IhpFl
giRZPBIIJMHe8RLvryIZjSijssm5f4jV3B7PWhus2f4d5g6MEoMBE1IGkv5BmUE+xktJ
agPprLd4htxF+mcGgIO16dagm3kR/8FXNaQS7Oc0bCCvqUjrS42z8Kr31LCWF54NES+U
SaDVP5udDmBlbZ7ofE9sy3gIZ2rlRfN1Ao/t4+BTC5CtreVqbPD0kNCIzbUNaDvRKV2g
9nhw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1792883225; x=1793488025;
h=cc:to:in-reply-to:references:message-id:content-transfer-encoding
:content-type:mime-version:subject:date:from:x-gm-gg
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
:content-type;
bh=ilKVSD9FJbr4rCgUq3aZ7XRBwC0roP+y+YvlkpAT2Pw=;
b=RZjaoE2TuCEwpL9GB8tbDH0NcpTgc3TR3TaSkA//P8oXAkI/TZp4THm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j2sdQsSKA8ig+tQsG0ILSF7VYEWPk/27/RPSNzxdJlBQJLm9
X-Received: by 2002:a17:907:2d21:b0:c3f:dce3:20d5 with SMTP id a640c23a62f3a-c46bdc10b94mr344242866b.22.1792883224932;
Sat, 24 Oct 2026 16:07:04 -0700 (PDT)
X-Received: from localhost ([2a03:2880:32ff:49::])
by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c46bd66fa1asm136868366b.62.2026.10.24.16.07.04
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Sat, 24 Oct 2026 16:07:04 -0700 (PDT)
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: <20261024-netcons-replay-upstream-v1-0-9613f38496e5@gmail.com>
X-Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
linux-doc@vger.kernel.org, Sam Crossley <samuelcrossley@gmail.com>
X-Mailer: b4 0.16-dev