public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: John Ogness <john.ogness@linutronix.de>
To: Breno Leitao <leitao@debian.org>, pmladek@suse.com, mpdesouza@suse.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	asantostc@gmail.com, efault@gmx.de, gustavold@gmail.com,
	calvin@wbinvd.org, jv@jvosburgh.net, kernel-team@meta.com,
	Petr Mladek <pmladek@suse.com>, Simon Horman <horms@kernel.org>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	rostedt@goodmis.org
Subject: Re: [PATCH net-next 0/2] net: netconsole: convert to NBCON console infrastructure
Date: Wed, 07 Jan 2026 16:56:41 +0106	[thread overview]
Message-ID: <87zf6pfmlq.fsf@jogness.linutronix.de> (raw)
In-Reply-To: <5mpei32y7sl5jmi2ciim4crxbc55zztiucxxsdd633mvzxlk7n@fowtsefym5y6>

Hi Breno,

On 2026-01-07, Breno Leitao <leitao@debian.org> wrote:
> On Mon, Dec 22, 2025 at 06:52:09AM -0800, Breno Leitao wrote:
>> This series adds support for the nbcon (new buffer console) infrastructure
>> to netconsole, enabling lock-free, priority-based console operations that
>> are safer in crash scenarios.
>
> I've been reflecting further on this port and encountered a potential
> roadblock that I'd like to discuss to ensure I'm heading in the right
> direction.
>
> Netconsole appends additional data (sysdata) to messages, specifically
> the CPU and task_struct->comm fields.
>
> Basically, it appends current->comm and raw_smp_processor_id()
> when sending a message.
> (For more details, see sysdata_append_cpu_nr() and
> sysdata_append_taskname())

I was not aware of this netconsole feature until now.

> With nbcon, since netconsole will operate on a separate thread, this
> sysdata may become inaccurate (the data would reflect the printk thread
> rather than the original task or CPU that generated the message).

Note that even with legacy consoles there was never a guarantee that the
printing context is the same CPU/task as the printk() caller. It was
just much more likely.

> Upon reviewing the printk subsystem, I noticed that struct
> printk_info->caller_id stores similar information, but not exactly the
> same. It contains either the CPU *or* the task, not both, and this data
> isn't easily accessible from within the ->write_thread() context. 
>
> One possible solution that comes to my mind is to pass both the CPU ID
> and the task_struct/vpid to struct printk_info, and then integrate this
> into struct nbcon_write_context *wctxt somehow.
>
> This way, netconsole could reliably query the original CPU and task that
> generated the message, regardless of where the netconsole code is
> executed.

But by the time the printer is active, that task may no longer exist,
may have migrated to a different CPU and/or may be sleeping.

IIUC, basically you want to attach console-specific additional
information to ringbuffer records, but only that specific console should
see/use the additional information. In this case it could be up to 4+16
additional bytes (depending on @sysdata_fields).

A while ago we had a discussion[0] about adding custom
information. There I even went so far as to suggest supporting things
like a new boot argument:

    printk.format=ts,cpu,comm,pid,in_atomic

(which could also be console-specific)

The result of the discussion was killing off dictionaries (that allowed
variable length custom data) and replacing them with the dev_printk_info
struct.

I am just pointing out that this kind of discussion has existed in the
past and not suggesting that we should reintroduce dictionaries.


A simple fix could be to add an extra 36-byte struct to both
dev_printk_info and nbcon_write_context that exists conditionally on
CONFIG_NETCONSOLE_DYNAMIC.

vprintk_store() would set the extra data to dev_printk_info.

nbcon_emit_next_record() would copy the data to nbcon_write_context.

John Ogness

[0] https://lore.kernel.org/lkml/20200904082438.20707-1-changki.kim@samsung.com

  reply	other threads:[~2026-01-07 15:50 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-22 14:52 [PATCH net-next 0/2] net: netconsole: convert to NBCON console infrastructure Breno Leitao
2025-12-22 14:52 ` [PATCH net-next 1/2] netconsole: extract message fragmentation into send_msg_udp() Breno Leitao
2025-12-22 14:52 ` [PATCH net-next 2/2] netconsole: convert to NBCON console infrastructure Breno Leitao
2026-01-02  3:54   ` Marcos Paulo de Souza
2026-01-06 15:43     ` Breno Leitao
2026-01-07 15:04       ` Marcos Paulo de Souza
2025-12-23  7:12 ` [PATCH net-next 0/2] net: " Paolo Abeni
2025-12-23  9:44   ` Breno Leitao
2026-01-07 14:49 ` Breno Leitao
2026-01-07 15:50   ` John Ogness [this message]
2026-01-07 16:58     ` Breno Leitao
2026-01-08 11:08       ` Breno Leitao
2026-01-08 16:50         ` John Ogness
2026-01-09 10:48           ` Breno Leitao
2026-01-09 13:29           ` Petr Mladek
2026-01-09 14:03             ` Petr Mladek
2026-01-09 15:13             ` John Ogness
2026-01-12 10:55               ` Breno Leitao
2026-01-12 12:44                 ` Breno Leitao
2026-01-16 15:51                   ` Petr Mladek
2026-01-16 15:53                     ` Petr Mladek
2026-01-16 18:07                       ` Breno Leitao
2026-01-19 14:00                         ` Petr Mladek
2026-01-19 16:34                           ` Breno Leitao
2026-01-20  8:59                             ` Petr Mladek
2026-01-20  9:17                               ` Breno Leitao
2026-01-20 10:10                               ` John Ogness
2026-01-12 14:17               ` Petr Mladek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zf6pfmlq.fsf@jogness.linutronix.de \
    --to=john.ogness@linutronix.de \
    --cc=andrew+netdev@lunn.ch \
    --cc=asantostc@gmail.com \
    --cc=calvin@wbinvd.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=efault@gmx.de \
    --cc=gustavold@gmail.com \
    --cc=horms@kernel.org \
    --cc=jv@jvosburgh.net \
    --cc=kernel-team@meta.com \
    --cc=kuba@kernel.org \
    --cc=leitao@debian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpdesouza@suse.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox