Re: [PATCH net-next v2 1/5] printk: Add execution context (task name/CPU) to printk_info

From: Breno Leitao

Date: Wed Jan 21 2026 - 06:54:42 EST


On Tue, Jan 20, 2026 at 08:23:47AM -0800, Breno Leitao wrote:
> Extend struct printk_info to include the task name, pid, and CPU
> number where printk messages originate. This information is captured
> at vprintk_store() time and propagated through printk_message to
> nbcon_write_context, making it available to nbcon console drivers.
>
> This is useful for consoles like netconsole that want to include
> execution context in their output, allowing correlation of messages
> with specific tasks and CPUs regardless of where the console driver
> actually runs.
>
> The feature is controlled by CONFIG_PRINTK_EXECUTION_CTX, which is
> automatically selected by CONFIG_NETCONSOLE_DYNAMIC. When disabled,
> the helper functions compile to no-ops with no overhead.
>
> Suggested-by: John Ogness <john.ogness@xxxxxxxxxxxxx>
> Signed-off-by: Breno Leitao <leitao@xxxxxxxxxx>
> Signed-off-by: Petr Mladek <pmladek@xxxxxxxx>
> ---
> drivers/net/Kconfig | 1 +
> include/linux/console.h | 8 ++++++
> kernel/printk/internal.h | 8 ++++++
> kernel/printk/nbcon.c | 15 +++++++++++
> kernel/printk/printk.c | 52 ++++++++++++++++++++++++++++++++++++++-
> kernel/printk/printk_ringbuffer.h | 4 +++
> lib/Kconfig.debug | 20 +++++++++++++++
> 7 files changed, 107 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
> index ac12eaf11755d..12e47cb27ffa5 100644
> --- a/drivers/net/Kconfig
> +++ b/drivers/net/Kconfig
> @@ -341,6 +341,7 @@ config NETCONSOLE_DYNAMIC
> bool "Dynamic reconfiguration of logging targets"
> depends on NETCONSOLE && SYSFS && CONFIGFS_FS && \
> !(NETCONSOLE=y && CONFIGFS_FS=m)
> + select CONSOLE_HAS_EXECUTION_CTX

This is wrong as detected by Kernel test robot.

https://lore.kernel.org/all/202601211304.r9ecHy9L-lkp@xxxxxxxxx/

On csky, CONSOLE_HAS_EXECUTION_CTX is set, but not
CONFIG_PRINTK_EXECUTION_CTX

https://download.01.org/0day-ci/archive/20260121/202601211304.r9ecHy9L-lkp@xxxxxxxxx/config

The execution context fields were not available, while
NETCONSOLE_DYNAMIC, causing a compilation error.

It needs to be:

+ select PRINTK_EXECUTION_CTX

--
pw-bot: cr