Skip to content

Commit a7aec70

Browse files
leitaodavem330
authored andcommitted
netconsole: docs: Add documentation for CPU number auto-population
Update the netconsole documentation to explain the new feature that allows automatic population of the CPU number. The key changes include introducing a new section titled "CPU number auto population in userdata", explaining how to enable the CPU number auto-population feature by writing to the "populate_cpu_nr" file in the netconsole configfs hierarchy. This documentation update ensures users are aware of the new CPU number auto-population functionality and how to leverage it for better demultiplexing and visibility of parallel netconsole output. Signed-off-by: Breno Leitao <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 12fd83c commit a7aec70

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

Documentation/networking/netconsole.rst

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ Release prepend support by Breno Leitao <[email protected]>, Jul 7 2023
1717

1818
Userdata append support by Matthew Wood <[email protected]>, Jan 22 2024
1919

20+
Sysdata append support by Breno Leitao <[email protected]>, Jan 15 2025
21+
2022
Please send bug reports to Matt Mackall <[email protected]>
2123
Satyam Sharma <[email protected]>, and Cong Wang <[email protected]>
2224

@@ -238,6 +240,49 @@ Delete `userdata` entries with `rmdir`::
238240

239241
It is recommended to not write user data values with newlines.
240242

243+
CPU number auto population in userdata
244+
--------------------------------------
245+
246+
Inside the netconsole configfs hierarchy, there is a file called
247+
`cpu_nr` under the `userdata` directory. This file is used to enable or disable
248+
the automatic CPU number population feature. This feature automatically
249+
populates the CPU number that is sending the message.
250+
251+
To enable the CPU number auto-population::
252+
253+
echo 1 > /sys/kernel/config/netconsole/target1/userdata/cpu_nr
254+
255+
When this option is enabled, the netconsole messages will include an additional
256+
line in the userdata field with the format `cpu=<cpu_number>`. This allows the
257+
receiver of the netconsole messages to easily differentiate and demultiplex
258+
messages originating from different CPUs, which is particularly useful when
259+
dealing with parallel log output.
260+
261+
Example::
262+
263+
echo "This is a message" > /dev/kmsg
264+
12,607,22085407756,-;This is a message
265+
cpu=42
266+
267+
In this example, the message was sent by CPU 42.
268+
269+
.. note::
270+
271+
If the user has set a conflicting `cpu` key in the userdata dictionary,
272+
both keys will be reported, with the kernel-populated entry appearing after
273+
the user one. For example::
274+
275+
# User-defined CPU entry
276+
mkdir -p /sys/kernel/config/netconsole/target1/userdata/cpu
277+
echo "1" > /sys/kernel/config/netconsole/target1/userdata/cpu/value
278+
279+
Output might look like::
280+
281+
12,607,22085407756,-;This is a message
282+
cpu=1
283+
cpu=42 # kernel-populated value
284+
285+
241286
Extended console:
242287
=================
243288

0 commit comments

Comments
 (0)