summaryrefslogtreecommitdiffstats
path: root/debian/patches-rt/0025-printk-Track-registered-boot-consoles.patch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 17:39:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 17:39:59 +0000
commit27d3313807296c3943a96ceef8c2b7279cb56962 (patch)
tree7d08e78c36ab6437b403fc7cd8c23e41f135c7a3 /debian/patches-rt/0025-printk-Track-registered-boot-consoles.patch
parentMerging upstream version 6.7.7. (diff)
downloadlinux-27d3313807296c3943a96ceef8c2b7279cb56962.tar.xz
linux-27d3313807296c3943a96ceef8c2b7279cb56962.zip
Adding debian version 6.7.7-1.debian/6.7.7-1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches-rt/0025-printk-Track-registered-boot-consoles.patch')
-rw-r--r--debian/patches-rt/0025-printk-Track-registered-boot-consoles.patch78
1 files changed, 78 insertions, 0 deletions
diff --git a/debian/patches-rt/0025-printk-Track-registered-boot-consoles.patch b/debian/patches-rt/0025-printk-Track-registered-boot-consoles.patch
new file mode 100644
index 0000000000..5c35ea115c
--- /dev/null
+++ b/debian/patches-rt/0025-printk-Track-registered-boot-consoles.patch
@@ -0,0 +1,78 @@
+From: John Ogness <john.ogness@linutronix.de>
+Date: Tue, 24 Oct 2023 14:13:14 +0000
+Subject: [PATCH 25/50] printk: Track registered boot consoles
+Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/6.7/older/patches-6.7-rt6.tar.xz
+
+Unfortunately it is not known if a boot console and a regular
+(legacy or nbcon) console use the same hardware. For this reason
+they must not be allowed to print simultaneously.
+
+For legacy consoles this is not an issue because they are
+already synchronized with the boot consoles using the console
+lock. However nbcon consoles can be triggered separately.
+
+Add a global flag @have_boot_console to identify if any boot
+consoles are registered. This will be used in follow-up commits
+to ensure that boot consoles and nbcon consoles cannot print
+simultaneously.
+
+Signed-off-by: John Ogness <john.ogness@linutronix.de>
+Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+---
+ kernel/printk/printk.c | 24 ++++++++++++++++++++++++
+ 1 file changed, 24 insertions(+)
+
+--- a/kernel/printk/printk.c
++++ b/kernel/printk/printk.c
+@@ -463,6 +463,14 @@ static int console_msg_format = MSG_FORM
+ /* syslog_lock protects syslog_* variables and write access to clear_seq. */
+ static DEFINE_MUTEX(syslog_lock);
+
++/*
++ * 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
++ * have mapped the same hardware.
++ */
++bool have_boot_console;
++
+ #ifdef CONFIG_PRINTK
+ DECLARE_WAIT_QUEUE_HEAD(log_wait);
+ /* All 3 protected by @syslog_lock. */
+@@ -3507,6 +3515,9 @@ void register_console(struct console *ne
+ if (newcon->flags & CON_NBCON)
+ nbcon_init(newcon);
+
++ if (newcon->flags & CON_BOOT)
++ have_boot_console = true;
++
+ /*
+ * Put this console in the list - keep the
+ * preferred driver at the head of the list.
+@@ -3559,6 +3570,8 @@ EXPORT_SYMBOL(register_console);
+ /* Must be called under console_list_lock(). */
+ static int unregister_console_locked(struct console *console)
+ {
++ bool found_boot_con = false;
++ struct console *c;
+ int res;
+
+ lockdep_assert_console_list_lock_held();
+@@ -3606,6 +3619,17 @@ static int unregister_console_locked(str
+ if (console->exit)
+ res = console->exit(console);
+
++ /*
++ * With this console gone, the global flags tracking registered
++ * console types may have changed. Update them.
++ */
++ for_each_console(c) {
++ if (c->flags & CON_BOOT)
++ found_boot_con = true;
++ }
++ if (!found_boot_con)
++ have_boot_console = false;
++
+ return res;
+ }
+