From patchwork Fri Jan 26 23:13:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wood X-Patchwork-Id: 192848 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2395:b0:106:343:edcb with SMTP id gw21csp205286dyb; Fri, 26 Jan 2024 15:15:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IELzWFI7BZjsYRqn41+uZAky/k97L19O1WYcV7rRge2iH1VJIkaKOFR0Tn/izHBCMiVEkzs X-Received: by 2002:a17:906:f290:b0:a31:45a6:2bb5 with SMTP id gu16-20020a170906f29000b00a3145a62bb5mr256724ejb.40.1706310943779; Fri, 26 Jan 2024 15:15:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706310943; cv=pass; d=google.com; s=arc-20160816; b=HJc9vUdycV30EJXI110cw50njum7/iib3l6vmrZhi6iQGwHFdc3wTi/9+6PUgfH02E WsINULeusmvJt11opMF4t2zHH3j6XdE4/RIV7fvgrOTa+Nmmi2S80Un/sN1ZT7hk9IVy 2+x3Ic0THfSk/aO375UT+GG6n4+Gm5iwaK3E34Bx3Z/tuFgJc0diG5DI1v/ehCoIDYV+ muD5mdMRkBl+EPuxSERlW8VQt4m9K8MDa87B3BLts8QlNt2CbG5QM+vXjAJw3t88ObVm 6kTVpHqs7ZKqCuHYNR6Yt2oD5ClN29Vc1NsFxCvwwGhZ/U6FaUuIGXh1nlt4l5ciCXo7 PR3g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=gneFCt4ceG2iUK09c51bLYD/2KQfSVJ2BvbrNzbdXrk=; fh=3uQAHc0NqngPtrB5YLPjrfJArntTgtKXo4NRJp5QtWs=; b=R4TDyw3hrre4BQjbmfbJMQfTImame8qCQNcGu9oUxjz80jojPccCca7mCAWD8E4N3T TGduOvMSqmEFeHLTh+yk9pNrl76VL0fzEANP6ugPy9JdX7sGen0pJ1dwNWorVaVZPgyR 4VTN5U+/CUZZoAa7SUjYOVSBNAUF3Nx3wDmBi7CqqK932p/ddxD5B3qbIWJas96s5GbB Phn5Nm2TkPVH7k4MDM9bykBbi75Edgo8cYvoAGm1zvlT8RF6HiMpbX4PnalndXmjOEbU JTk+2bwVLTrU7RFUskkvUsujv6xmbqqnhrF279RMOdq/SBfSu8EUfTaa5Zl+Ww+HOZlm wCIw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gjYlVpoV; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-40811-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40811-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id j14-20020a170906278e00b00a3180b2c246si985194ejc.867.2024.01.26.15.15.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 15:15:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-40811-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gjYlVpoV; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-40811-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40811-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 3553B1F2280E for ; Fri, 26 Jan 2024 23:15:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1BA215BACA; Fri, 26 Jan 2024 23:14:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gjYlVpoV" Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8953B5A7A9; Fri, 26 Jan 2024 23:14:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706310844; cv=none; b=MHA1/MVcahNJWucmtdtUhBGTG1rIaowhPDxpAjqxPGpNJge1ZYtyzciZq1tLhOytMu9LhX3NH8APNNS7olW81PZnAznLe/g0YL2Q0KirnYTm+LUNpfZjAaHQEDofUymmPWNvY2bO7wFYP75WIwva9fBc9eC5GLJmr0Kh//nTCGg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706310844; c=relaxed/simple; bh=JUBz4HV56EeU4/nPAgND0SO1KSnQD6Dq6LeiFiNVnDw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QOjtZ0PXo4b0f/lQNdOeUeibmms/GvmNcytq3Yv2pCr3hJj40EEj/MNPvSrgni7CGpNCnIKbj3DFIudGam8sY8SpefM+VjU9/wOoHPfFOSp+6gAvd2lPran+biyknm3nZAIrnlwP4rbLmKU3RK5zbMpLWYG1c3F0Y77wR3FCOk8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gjYlVpoV; arc=none smtp.client-ip=209.85.214.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-1d71e184695so6162055ad.3; Fri, 26 Jan 2024 15:14:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706310841; x=1706915641; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gneFCt4ceG2iUK09c51bLYD/2KQfSVJ2BvbrNzbdXrk=; b=gjYlVpoVAcTPdVotSYVxzOP2J18W/qtl/RzfofHdUILoNuZz31r2dW1vhg43RE25qC Fnypm6L1SJT8SMj3XuwSGDD1Oc2rfzsg/b80idoFlzTz3FDLzBs4mRMFzyjutZXaSxN7 ddp3EbGkt+DTd8X/qn+/7APBnopKhy3kjd6bXU8wj6MhoJzL+tKjUVBZF1oRlPb7BB1w lB+EizqwLfT27i+lPXnX4LJH1TIMJOLmsf41wCa7lMbfwceCdcM5gkVwoDDYsxRLsJbq cOZWy+HJvJ1ESTJd2EtHed8var8EZH18diZb0EzuuNITkDMXO1rgjCqZbGU660zojxsg vAzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706310841; x=1706915641; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gneFCt4ceG2iUK09c51bLYD/2KQfSVJ2BvbrNzbdXrk=; b=vX6utjTi8tIpO5WSUgNA+YfXzTjqimyyAHcD2xc/Be51+7KuaOw7qbM7qvqkWjWNKI 2VQqp3zkuZfzF1xpimn2n/4LKRvNCKX3akPyWnd+WUJQiKN2t8HDS89XPs2qh+DIjPCZ lb+L0Bv8QyDFVBoE/bERJr1Se0YqgYZJgps+zs6Yeuuek0vZgul5m1QAkVMu6dG+ip5l UHG59L1PK+n+urywPJiv5Uh+Z424rbmTGs9UsYfUZQE8pooaPVlrFRCyA3aYWTojaNd1 Ut+yOpgF8FF41bNMBzKiNt2jqyZhuFeZqu5RFgOvwnjwhlhzfsZvE/LRnWaRy7ajF8yM aKsQ== X-Gm-Message-State: AOJu0YzV62rrugyW96IUYEyeumRNmkTwVS7+KgIn80r1fRox8R9pasv0 d+ZF+wDg6C/IwsESWfF+RzIJih55B00rbZnoYwYsylsa5xc7ZMBJ X-Received: by 2002:a17:902:9f88:b0:1d7:7b3d:99b7 with SMTP id g8-20020a1709029f8800b001d77b3d99b7mr743822plq.132.1706310840741; Fri, 26 Jan 2024 15:14:00 -0800 (PST) Received: from localhost ([2601:644:9380:8cd0::7fb4]) by smtp.gmail.com with ESMTPSA id y20-20020a170902e19400b001d71923136csm1431251pla.211.2024.01.26.15.13.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 15:14:00 -0800 (PST) From: Matthew Wood To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jonathan Corbet Cc: leitao@debian.org, netdev@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 4/8] net: netconsole: add docs for appending netconsole user data Date: Fri, 26 Jan 2024 15:13:39 -0800 Message-ID: <20240126231348.281600-5-thepacketgeek@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240126231348.281600-1-thepacketgeek@gmail.com> References: <20240126231348.281600-1-thepacketgeek@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789196703839526338 X-GMAIL-MSGID: 1789196703839526338 Add a new User Data section to the netconsole docs to describe the appending of user data capability (for netconsole dynamic configuration) with usage and netconsole output examples. Co-developed-by: Breno Leitao Signed-off-by: Breno Leitao Signed-off-by: Matthew Wood --- Documentation/networking/netconsole.rst | 68 +++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/Documentation/networking/netconsole.rst b/Documentation/networking/netconsole.rst index 390730a74332..54f072f47921 100644 --- a/Documentation/networking/netconsole.rst +++ b/Documentation/networking/netconsole.rst @@ -15,6 +15,8 @@ Extended console support by Tejun Heo , May 1 2015 Release prepend support by Breno Leitao , Jul 7 2023 +Userdata append support by Matthew Wood , Jan 22 2024 + Please send bug reports to Matt Mackall Satyam Sharma , and Cong Wang @@ -171,6 +173,72 @@ You can modify these targets in runtime by creating the following targets:: cat cmdline1/remote_ip 10.0.0.3 +Append User Data +================ + +Custom user data can be appended to the end of messages with netconsole +dynamic configuration enabled. User data entries can be modified without +changing the "enabled" attribute of a target. + +Directories (keys) under `userdata` are limited to 54 character length, and +data in `userdata//value` are limited to 200 bytes:: + + cd /sys/kernel/config/netconsole && mkdir cmdline0 + cd cmdline0 + mkdir userdata/foo + echo bar > userdata/foo/value + mkdir userdata/qux + echo baz > userdata/qux/value + +Messages will now include this additional user data:: + + echo "This is a message" > /dev/kmsg + +Sends:: + + 12,607,22085407756,-;This is a message + foo=bar + qux=baz + +Preview the userdata that will be appended with:: + + cd /sys/kernel/config/netconsole/cmdline0/userdata + for f in `ls userdata`; do echo $f=$(cat userdata/$f/value); done + +If a `userdata` entry is created but no data is written to the `value` file, +the entry will be omitted from netconsole messages:: + + cd /sys/kernel/config/netconsole && mkdir cmdline0 + cd cmdline0 + mkdir userdata/foo + echo bar > userdata/foo/value + mkdir userdata/qux + +The `qux` key is omitted since it has no value:: + + echo "This is a message" > /dev/kmsg + 12,607,22085407756,-;This is a message + foo=bar + +Delete `userdata` entries with `rmdir`:: + + rmdir /sys/kernel/config/netconsole/cmdline0/userdata/qux + +Beware of `userdata` entries with newlines since values are printed with +newlines preserved. A userdatum value with a newline could cause the +netconsole message receiver to interpret a value as a new userdata key:: + + cat userdata/foo/value + bar + bar2 + +The `qux` key is omitted since it has no value:: + + echo "This is a message" > /dev/kmsg + 12,607,22085407756,-;This is a message + foo=bar + bar2 + Extended console: =================