summaryrefslogtreecommitdiffstats
path: root/debian/patches-rt/0043-printk-nbcon-Provide-function-to-reacquire-ownership.patch
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--debian/patches-rt/0043-printk-nbcon-Provide-function-to-reacquire-ownership.patch (renamed from debian/patches-rt/0045-printk-nbcon-Provide-function-to-reacquire-ownership.patch)42
1 files changed, 35 insertions, 7 deletions
diff --git a/debian/patches-rt/0045-printk-nbcon-Provide-function-to-reacquire-ownership.patch b/debian/patches-rt/0043-printk-nbcon-Provide-function-to-reacquire-ownership.patch
index 98e303d30e..5dd9fe97d7 100644
--- a/debian/patches-rt/0045-printk-nbcon-Provide-function-to-reacquire-ownership.patch
+++ b/debian/patches-rt/0043-printk-nbcon-Provide-function-to-reacquire-ownership.patch
@@ -1,7 +1,7 @@
From: John Ogness <john.ogness@linutronix.de>
Date: Fri, 20 Oct 2023 10:01:58 +0000
-Subject: [PATCH 45/50] printk: nbcon: Provide function to reacquire ownership
-Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/6.7/older/patches-6.7-rt6.tar.xz
+Subject: [PATCH 43/48] printk: nbcon: Provide function to reacquire ownership
+Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/6.8/older/patches-6.8.2-rt11.tar.xz
Contexts may become nbcon owners for various reasons, not just
for printing. Indeed, the port->lock wrapper takes ownership
@@ -27,13 +27,25 @@ lost. nbcon_reacquire() cannot be used to resume printing.
Signed-off-by: John Ogness <john.ogness@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
- include/linux/console.h | 2 ++
- kernel/printk/nbcon.c | 32 ++++++++++++++++++++++++++++++++
- 2 files changed, 34 insertions(+)
+ include/linux/console.h | 7 +++++++
+ kernel/printk/nbcon.c | 41 +++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 48 insertions(+)
--- a/include/linux/console.h
+++ b/include/linux/console.h
-@@ -481,12 +481,14 @@ extern void nbcon_cpu_emergency_exit(voi
+@@ -371,6 +371,11 @@ struct console {
+ * functions are also points of possible ownership transfer. If
+ * either function returns false, ownership has been lost.
+ *
++ * If the driver must reacquire ownership in order to finalize or
++ * revert hardware changes, nbcon_reacquire() can be used. However,
++ * on reacquire the buffer content is no longer available. A
++ * reacquire cannot be used to resume printing.
++ *
+ * This callback can be called from any context (including NMI).
+ * Therefore it must avoid usage of any locking and instead rely
+ * on the console ownership for synchronization.
+@@ -595,12 +600,14 @@ extern void nbcon_cpu_emergency_exit(voi
extern bool nbcon_can_proceed(struct nbcon_write_context *wctxt);
extern bool nbcon_enter_unsafe(struct nbcon_write_context *wctxt);
extern bool nbcon_exit_unsafe(struct nbcon_write_context *wctxt);
@@ -50,7 +62,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
extern int console_set_on_cmdline;
--- a/kernel/printk/nbcon.c
+++ b/kernel/printk/nbcon.c
-@@ -831,6 +831,38 @@ bool nbcon_exit_unsafe(struct nbcon_writ
+@@ -839,6 +839,38 @@ bool nbcon_exit_unsafe(struct nbcon_writ
EXPORT_SYMBOL_GPL(nbcon_exit_unsafe);
/**
@@ -89,3 +101,19 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
* nbcon_emit_next_record - Emit a record in the acquired context
* @wctxt: The write context that will be handed to the write function
* @use_atomic: True if the write_atomic callback is to be used
+@@ -944,6 +976,15 @@ static bool nbcon_emit_next_record(struc
+ nbcon_context_release(ctxt);
+ return false;
+ }
++
++ if (!wctxt->outbuf) {
++ /*
++ * Ownership was lost and reacquired by the driver.
++ * Handle it as if ownership was lost and try to continue.
++ */
++ nbcon_context_release(ctxt);
++ return false;
++ }
+
+ /*
+ * Since any dropped message was successfully output, reset the