diff options
author | John Ogness <john.ogness@linutronix.de> | 2023-12-11 12:36:52 +0300 |
---|---|---|
committer | Andy Hu <andy.hu@starfivetech.com> | 2024-12-06 13:24:25 +0300 |
commit | c5403c36097025966810a27212ed9c68915e888d (patch) | |
tree | bc15377f7168f6eaf48984470b21de02a3d7b3e6 | |
parent | ab3b0118d88106ff768c51c0fd64134f95431b12 (diff) | |
download | linux-c5403c36097025966810a27212ed9c68915e888d.tar.xz |
printk: Track nbcon consoles
Add a global flag @have_nbcon_console to identify if any nbcon
consoles are registered. This will be used in follow-up commits
to preserve legacy behavior when no nbcon consoles are registered.
Signed-off-by: John Ogness <john.ogness@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
-rw-r--r-- | kernel/printk/printk.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 26958c8b2810..e84da28db173 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -471,6 +471,13 @@ static DEFINE_MUTEX(syslog_lock); bool have_legacy_console; /* + * Specifies if an nbcon console is registered. If nbcon consoles are present, + * synchronous printing of legacy consoles will not occur during panic until + * the backtrace has been stored to the ringbuffer. + */ +bool have_nbcon_console; + +/* * Specifies if a boot console is registered. If boot consoles are present, * nbcon consoles cannot print simultaneously and must be synchronized by * the console lock. This is because boot consoles and nbcon consoles may @@ -3523,6 +3530,7 @@ void register_console(struct console *newcon) console_init_seq(newcon, bootcon_registered); if (newcon->flags & CON_NBCON) { + have_nbcon_console = true; nbcon_init(newcon); } else { have_legacy_console = true; @@ -3584,6 +3592,7 @@ EXPORT_SYMBOL(register_console); static int unregister_console_locked(struct console *console) { bool found_legacy_con = false; + bool found_nbcon_con = false; bool found_boot_con = false; struct console *c; int res; @@ -3640,13 +3649,18 @@ static int unregister_console_locked(struct console *console) for_each_console(c) { if (c->flags & CON_BOOT) found_boot_con = true; - if (!(c->flags & CON_NBCON)) + + if (c->flags & CON_NBCON) + found_nbcon_con = true; + else found_legacy_con = true; } if (!found_boot_con) have_boot_console = false; if (!found_legacy_con) have_legacy_console = false; + if (!found_nbcon_con) + have_nbcon_console = false; return res; } |