@@ -17,6 +17,8 @@ Release prepend support by Breno Leitao <
[email protected] >, Jul 7 2023
1717
1818Userdata append support by Matthew Wood <
[email protected] >, Jan 22 2024
1919
20+ Sysdata append support by Breno Leitao <
[email protected] >, Jan 15 2025
21+
2022Please send bug reports to Matt Mackall <
[email protected] >
2123Satyam 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+
241286Extended console:
242287=================
243288
0 commit comments