From: John Ogness <john.ogness@linutronix.de>
To: Petr Mladek <pmladek@suse.com>
Cc: Marcos Paulo de Souza <mpdesouza@suse.com>,
Daniel Thompson <daniel@riscstar.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Steven Rostedt <rostedt@goodmis.org>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Jason Wessel <jason.wessel@windriver.com>,
Daniel Thompson <danielt@kernel.org>,
Douglas Anderson <dianders@chromium.org>,
linux-kernel@vger.kernel.org,
kgdb-bugreport@lists.sourceforge.net
Subject: Re: [PATCH v2 3/3] kdb: Adapt kdb_msg_write to work with NBCON consoles
Date: Mon, 01 Sep 2025 14:33:00 +0206 [thread overview]
Message-ID: <84plca5pez.fsf@jogness.linutronix.de> (raw)
In-Reply-To: <aLWHmY9_I4rbV0wG@pathway.suse.cz>
On 2025-09-01, Petr Mladek <pmladek@suse.com> wrote:
> What about the following race?
>
> kdb_printf_cpu = -1 (0xffffffff)
>
> CPU 0xff CPU 0x1
>
> panic()
>
> printk()
> nbcon_atomic_flush_pending()
> nbcon_context_try_acquire_direct()
> # load low byte of kdb_printf_cpu
> val = 0xff
>
> vkdb_printf()
> cmpxchg(&kdb_printf_cpu, ...)
> kdb_printf_cpu == 0x1
>
> # load higher byte of kdb_printf_cpu
> val = 0xff
>
> Result: CPU 0xff would be allowed to acquire the nbcon context
> because it thinks that vkdb_printf() got locked on this CPU.
>
> It is not fully artificial, see
> https://lwn.net/Articles/793253/#Load%20Tearing
>
> The above race is not critical. CPU 0x1 still could wait for CPU 0xff
> and acquire the nbcon context later.
>
> But it is something unexpected. I would feel more comfortable if
> we used the READ_ONCE() and be on the safe side.
Agreed.
John
next prev parent reply other threads:[~2025-09-01 12:27 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-11 13:32 [PATCH v2 0/3] Handle NBCON consoles on KDB Marcos Paulo de Souza
2025-08-11 13:32 ` [PATCH v2 1/3] printk: nbcon: Export console_is_usable Marcos Paulo de Souza
2025-08-20 15:03 ` Petr Mladek
2025-08-11 13:32 ` [PATCH v2 2/3] printk: nbcon: Introduce KDB helpers Marcos Paulo de Souza
2025-08-26 14:30 ` John Ogness
2025-08-29 12:30 ` Marcos Paulo de Souza
2025-08-28 15:26 ` Petr Mladek
2025-08-29 12:33 ` Marcos Paulo de Souza
2025-08-11 13:32 ` [PATCH v2 3/3] kdb: Adapt kdb_msg_write to work with NBCON consoles Marcos Paulo de Souza
2025-08-11 14:38 ` Daniel Thompson
2025-08-11 19:19 ` Marcos Paulo de Souza
2025-08-26 15:11 ` John Ogness
2025-08-29 13:15 ` Petr Mladek
2025-08-29 14:01 ` Marcos Paulo de Souza
2025-08-29 14:12 ` John Ogness
2025-09-01 11:46 ` Petr Mladek
2025-09-01 12:27 ` John Ogness [this message]
2025-08-12 17:14 ` [PATCH v2 0/3] Handle NBCON consoles on KDB Marcos Paulo de Souza
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=84plca5pez.fsf@jogness.linutronix.de \
--to=john.ogness@linutronix.de \
--cc=daniel@riscstar.com \
--cc=danielt@kernel.org \
--cc=dianders@chromium.org \
--cc=gregkh@linuxfoundation.org \
--cc=jason.wessel@windriver.com \
--cc=kgdb-bugreport@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mpdesouza@suse.com \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.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;
as well as URLs for NNTP newsgroup(s).