[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250915-nbcon-kgdboc-v4-0-e2b6753bb566@suse.com>
Date: Mon, 15 Sep 2025 08:20:29 -0300
From: Marcos Paulo de Souza <mpdesouza@...e.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Petr Mladek <pmladek@...e.com>, Steven Rostedt <rostedt@...dmis.org>,
John Ogness <john.ogness@...utronix.de>,
Sergey Senozhatsky <senozhatsky@...omium.org>,
Jason Wessel <jason.wessel@...driver.com>,
Daniel Thompson <danielt@...nel.org>,
Douglas Anderson <dianders@...omium.org>
Cc: linux-kernel@...r.kernel.org, kgdb-bugreport@...ts.sourceforge.net,
Marcos Paulo de Souza <mpdesouza@...e.com>
Subject: [PATCH v4 0/5] Handle NBCON consoles on KDB
In v4, only the first patch wasn't changed, all other received updates. A
new patch was added to export nbcon_write_context_set_buf helper. All
changes were made by following the suggestions from John Ogness and Petr
Mladek, thanks a lot for your reviews and suggestions!
As usual, how I tested the changes:
Testing
-------
I did the tests using qemu and reapplying commit f79b163c4231
('Revert "serial: 8250: Switch to nbcon console"') created originally by
John, just to exercise the common 8250 serial from qemu. The commit can
be checked on [1]. I had to solve some conflicts since the code has been
reworked after the commit was reverted.
Then I would create three different serial entries on qemu:
-serial mon:stdio -serial pty -serial pty
And for the kernel command line I added:
earlyprintk=serial,ttyS2 console=ttyS2 console=ttyS1 console=ttyS1 kgdboc=ttyS1,115200
Without the last patch on this patchset, when KDB is triggered, the mirroring
only worked on the earlyprintk console, since it's using the legacy console.
With the last patch applied, KDB mirroring works on legacy and nbcon
console. For debugging I added some messages to be printed by KDB, showing
also the console->name and console->index, and I was able to see both
->write and ->write_atomic being called, and it all working together.
[1]: https://github.com/marcosps/linux/commit/618bd49f8533db85d9c322f9ad1cb0da22aca9ee
Signed-off-by: Marcos Paulo de Souza <mpdesouza@...e.com>
---
Changes in v4:
- Added ifdefs to only check for KGDB if KGDB was enabled, suggested by John Ogness
- Updated comments about KDB on acquire_direct, suggested by Petr and John
- Added a new patch to export nbcon_write_context_set_buf, suggested by Petr and John
- Link to v3: https://lore.kernel.org/r/20250902-nbcon-kgdboc-v3-0-cd30a8106f1c@suse.com
Changes in v3:
- Only call nbcon_context_release if nbcon_context_exit_unsafe returns true (John Ogness)
- Dropped the prototype of console_is_usable from kernel/printk/internal. (Petr Mladek)
- Add comments to the new functions introduced (Petr Mladek)
- Flush KDB console on nbcon_kdb_release (Petr Mladek)
- Add an exception for KDB on nbcon_context_try_acquire_direct (John Ogness and Petr Mladek)
- Link to v2: https://lore.kernel.org/r/20250811-nbcon-kgdboc-v2-0-c7c72bcdeaf6@suse.com
Changes in v2:
- Set by mistake ..
- Link to v1: https://lore.kernel.org/r/20250713-nbcon-kgdboc-v1-0-51eccd9247a8@suse.com
---
Marcos Paulo de Souza (5):
printk: nbcon: Export console_is_usable
printk: nbcon: Introduce KDB helpers
printk: nbcon: Allow KDB to acquire the NBCON context
printk: nbcon: Export nbcon_write_context_set_buf
kdb: Adapt kdb_msg_write to work with NBCON consoles
include/linux/console.h | 54 ++++++++++++++++++++++++++++++++++
include/linux/kdb.h | 6 ++++
kernel/debug/kdb/kdb_io.c | 47 +++++++++++++++++++----------
kernel/printk/internal.h | 44 ---------------------------
kernel/printk/nbcon.c | 75 +++++++++++++++++++++++++++++++++++++++++++++--
5 files changed, 165 insertions(+), 61 deletions(-)
---
base-commit: caa285912f4901a5acdb38624f1ae157e3cd9c4c
change-id: 20250713-nbcon-kgdboc-efcfc37fde46
Best regards,
--
Marcos Paulo de Souza <mpdesouza@...e.com>
Powered by blists - more mailing lists