summaryrefslogtreecommitdiffstats
path: root/debian/patches-rt/0032-printk-nbcon-Add-context-to-console_is_usable.patch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-07 13:11:37 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-07 13:11:37 +0000
commit85f603d4fd6d85c425502723a17daa94574977de (patch)
tree188a21432c3b8e8ddb8a08e9a09397164a88181c /debian/patches-rt/0032-printk-nbcon-Add-context-to-console_is_usable.patch
parentMerging upstream version 6.9.7. (diff)
downloadlinux-85f603d4fd6d85c425502723a17daa94574977de.tar.xz
linux-85f603d4fd6d85c425502723a17daa94574977de.zip
Adding debian version 6.9.7-1.debian/6.9.7-1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches-rt/0032-printk-nbcon-Add-context-to-console_is_usable.patch')
-rw-r--r--debian/patches-rt/0032-printk-nbcon-Add-context-to-console_is_usable.patch120
1 files changed, 120 insertions, 0 deletions
diff --git a/debian/patches-rt/0032-printk-nbcon-Add-context-to-console_is_usable.patch b/debian/patches-rt/0032-printk-nbcon-Add-context-to-console_is_usable.patch
new file mode 100644
index 0000000000..6c74d8e079
--- /dev/null
+++ b/debian/patches-rt/0032-printk-nbcon-Add-context-to-console_is_usable.patch
@@ -0,0 +1,120 @@
+From: John Ogness <john.ogness@linutronix.de>
+Date: Tue, 26 Sep 2023 14:43:30 +0000
+Subject: [PATCH 32/46] printk: nbcon: Add context to console_is_usable()
+Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/6.9/older/patches-6.9-rt5.tar.xz
+
+The nbcon consoles have two callbacks to be used for different
+contexts. In order to determine if an nbcon console is usable,
+console_is_usable() needs to know if it is a context that will
+use the write_atomic() callback or the write_thread() callback.
+
+Add an extra parameter @use_atomic to specify this.
+
+Signed-off-by: John Ogness <john.ogness@linutronix.de>
+Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+---
+ kernel/printk/internal.h | 16 ++++++++++------
+ kernel/printk/nbcon.c | 8 ++++----
+ kernel/printk/printk.c | 6 ++++--
+ 3 files changed, 18 insertions(+), 12 deletions(-)
+
+--- a/kernel/printk/internal.h
++++ b/kernel/printk/internal.h
+@@ -98,7 +98,7 @@ void nbcon_kthread_create(struct console
+ * which can also play a role in deciding if @con can be used to print
+ * records.
+ */
+-static inline bool console_is_usable(struct console *con, short flags)
++static inline bool console_is_usable(struct console *con, short flags, bool use_atomic)
+ {
+ if (!(flags & CON_ENABLED))
+ return false;
+@@ -107,10 +107,13 @@ static inline bool console_is_usable(str
+ return false;
+
+ if (flags & CON_NBCON) {
+- if (!con->write_atomic)
+- return false;
+- if (!con->write_thread)
+- return false;
++ if (use_atomic) {
++ if (!con->write_atomic)
++ return false;
++ } else {
++ if (!con->write_thread)
++ return false;
++ }
+ } else {
+ if (!con->write)
+ return false;
+@@ -175,7 +178,8 @@ static inline void nbcon_atomic_flush_pe
+ static inline bool nbcon_legacy_emit_next_record(struct console *con, bool *handover,
+ int cookie) { return false; }
+
+-static inline bool console_is_usable(struct console *con, short flags) { return false; }
++static inline bool console_is_usable(struct console *con, short flags,
++ bool use_atomic) { return false; }
+
+ #endif /* CONFIG_PRINTK */
+
+--- a/kernel/printk/nbcon.c
++++ b/kernel/printk/nbcon.c
+@@ -968,7 +968,7 @@ static bool nbcon_kthread_should_wakeup(
+ cookie = console_srcu_read_lock();
+
+ flags = console_srcu_read_flags(con);
+- if (console_is_usable(con, flags)) {
++ if (console_is_usable(con, flags, false)) {
+ /* Bring the sequence in @ctxt up to date */
+ ctxt->seq = nbcon_seq_read(con);
+
+@@ -1026,7 +1026,7 @@ static int nbcon_kthread_func(void *__co
+
+ con_flags = console_srcu_read_flags(con);
+
+- if (console_is_usable(con, con_flags)) {
++ if (console_is_usable(con, con_flags, false)) {
+ con->device_lock(con, &flags);
+
+ /*
+@@ -1312,7 +1312,7 @@ static void __nbcon_atomic_flush_pending
+ if (!(flags & CON_NBCON))
+ continue;
+
+- if (!console_is_usable(con, flags))
++ if (!console_is_usable(con, flags, true))
+ continue;
+
+ if (nbcon_seq_read(con) >= stop_seq)
+@@ -1618,7 +1618,7 @@ void nbcon_driver_release(struct console
+ * the console is usable throughout flushing.
+ */
+ cookie = console_srcu_read_lock();
+- if (console_is_usable(con, console_srcu_read_flags(con)) &&
++ if (console_is_usable(con, console_srcu_read_flags(con), true) &&
+ !con->kthread &&
+ prb_read_valid(prb, nbcon_seq_read(con), NULL)) {
+ __nbcon_atomic_flush_pending_con(con, prb_next_reserve_seq(prb), false);
+--- a/kernel/printk/printk.c
++++ b/kernel/printk/printk.c
+@@ -3043,7 +3043,7 @@ static bool console_flush_all(bool do_co
+ if ((flags & CON_NBCON) && con->kthread)
+ continue;
+
+- if (!console_is_usable(con, flags))
++ if (!console_is_usable(con, flags, true))
+ continue;
+ any_usable = true;
+
+@@ -4001,8 +4001,10 @@ static bool __pr_flush(struct console *c
+ * that they make forward progress, so only increment
+ * @diff for usable consoles.
+ */
+- if (!console_is_usable(c, flags))
++ if (!console_is_usable(c, flags, true) &&
++ !console_is_usable(c, flags, false)) {
+ continue;
++ }
+
+ if (flags & CON_NBCON) {
+ printk_seq = nbcon_seq_read(c);