netconsole: add support for sysdata and CPU population
authorBreno Leitao <leitao@debian.org>
Thu, 6 Feb 2025 11:05:57 +0000 (03:05 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 10 Feb 2025 15:04:18 +0000 (15:04 +0000)
commitec15bc46c63cc21bba4c4071060797a4b51f50de
treece2a16192a93d63cadee7a815a9f9c432169b610
parent2bae25b16aea249f0e96757b6cd28b03d2b4397f
netconsole: add support for sysdata and CPU population

Add infrastructure to automatically append kernel-generated data (sysdata)
to netconsole messages. As the first use case, implement CPU number
population, which adds the CPU that sent the message.

This change introduces three distinct data types:
- extradata: The complete set of appended data (sysdata + userdata)
- userdata: User-provided key-value pairs from userspace
- sysdata: Kernel-populated data (e.g. cpu=XX)

The implementation adds a new configfs attribute 'cpu_nr' to control CPU
number population per target. When enabled, each message is tagged with
its originating CPU. The sysdata is dynamically updated at message time
and appended after any existing userdata.

The CPU number is formatted as "cpu=XX" and is added to the extradata
buffer, respecting the existing size limits.

Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/netconsole.c