diff options
Diffstat (limited to 'debian/patches-rt/0018-printk-nbcon-Provide-function-to-flush-using-write_a.patch')
-rw-r--r-- | debian/patches-rt/0018-printk-nbcon-Provide-function-to-flush-using-write_a.patch | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/debian/patches-rt/0018-printk-nbcon-Provide-function-to-flush-using-write_a.patch b/debian/patches-rt/0018-printk-nbcon-Provide-function-to-flush-using-write_a.patch index b42d8623bb..bca566898c 100644 --- a/debian/patches-rt/0018-printk-nbcon-Provide-function-to-flush-using-write_a.patch +++ b/debian/patches-rt/0018-printk-nbcon-Provide-function-to-flush-using-write_a.patch @@ -1,8 +1,8 @@ From: Thomas Gleixner <tglx@linutronix.de> Date: Tue, 12 Sep 2023 12:00:08 +0000 -Subject: [PATCH 18/46] printk: nbcon: Provide function to flush using +Subject: [PATCH 18/48] printk: nbcon: Provide function to flush using write_atomic() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/6.9/older/patches-6.9-rt5.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/6.10/older/patches-6.10.2-rt14.tar.xz Provide nbcon_atomic_flush_pending() to perform flushing of all registered nbcon consoles using their write_atomic() callback. @@ -30,19 +30,20 @@ Use it in console_flush_on_panic() before flushing legacy consoles. The legacy write() callbacks are not fully safe when oops_in_progress is set. -Also use it in nbcon_driver_release() to flush records added +Also use it in nbcon_device_release() to flush records added while the driver had the console locked to perform non-printing operations. Co-developed-by: John Ogness <john.ogness@linutronix.de> Signed-off-by: John Ogness <john.ogness@linutronix.de> Signed-off-by: Thomas Gleixner (Intel) <tglx@linutronix.de> +Reviewed-by: Petr Mladek <pmladek@suse.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> --- kernel/printk/internal.h | 2 - kernel/printk/nbcon.c | 162 ++++++++++++++++++++++++++++++++++++++++++++++- + kernel/printk/nbcon.c | 169 ++++++++++++++++++++++++++++++++++++++++++++++- kernel/printk/printk.c | 2 - 3 files changed, 163 insertions(+), 3 deletions(-) + 3 files changed, 170 insertions(+), 3 deletions(-) --- a/kernel/printk/internal.h +++ b/kernel/printk/internal.h @@ -72,7 +73,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> static bool nbcon_emit_next_record(struct nbcon_write_context *wctxt) { struct nbcon_context *ctxt = &ACCESS_PRIVATE(wctxt, ctxt); -@@ -953,6 +952,148 @@ enum nbcon_prio nbcon_get_default_prio(v +@@ -953,6 +952,155 @@ enum nbcon_prio nbcon_get_default_prio(v return NBCON_PRIO_NORMAL; } @@ -122,6 +123,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> + return -EAGAIN; + + if (!ctxt->backlog) { ++ /* Are there reserved but not yet finalized records? */ + if (nbcon_seq_read(con) < stop_seq) + err = -ENOENT; + break; @@ -162,19 +164,25 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> + local_irq_restore(flags); + + /* ++ * If there was a new owner (-EPERM, -EAGAIN), that context is ++ * responsible for completing. ++ * ++ * Do not wait for records not yet finalized (-ENOENT) to avoid a ++ * possible deadlock. They will either get flushed by the writer or ++ * eventually skipped on panic CPU. ++ */ ++ if (err) ++ return; ++ ++ /* + * If flushing was successful but more records are available, this + * context must flush those remaining records because there is no + * other context that will do it. + */ -+ if (!err && prb_read_valid(prb, nbcon_seq_read(con), NULL)) { ++ if (prb_read_valid(prb, nbcon_seq_read(con), NULL)) { + stop_seq = prb_next_reserve_seq(prb); + goto again; + } -+ -+ /* -+ * If there was a new owner, that context is responsible for -+ * completing the flush. -+ */ +} + +/** @@ -221,10 +229,10 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> /** * nbcon_alloc - Allocate buffers needed by the nbcon console * @con: Console to allocate buffers for -@@ -1064,8 +1205,23 @@ EXPORT_SYMBOL_GPL(nbcon_driver_try_acqui - void nbcon_driver_release(struct console *con) +@@ -1065,8 +1213,23 @@ EXPORT_SYMBOL_GPL(nbcon_device_try_acqui + void nbcon_device_release(struct console *con) { - struct nbcon_context *ctxt = &ACCESS_PRIVATE(con, nbcon_driver_ctxt); + struct nbcon_context *ctxt = &ACCESS_PRIVATE(con, nbcon_device_ctxt); + int cookie; - if (nbcon_context_exit_unsafe(ctxt)) @@ -246,12 +254,12 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> + } + console_srcu_read_unlock(cookie); } - EXPORT_SYMBOL_GPL(nbcon_driver_release); + EXPORT_SYMBOL_GPL(nbcon_device_release); --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c -@@ -3172,6 +3172,8 @@ void console_flush_on_panic(enum con_flu - console_srcu_read_unlock(cookie); - } +@@ -3184,6 +3184,8 @@ void console_flush_on_panic(enum con_flu + if (mode == CONSOLE_REPLAY_ALL) + __console_rewind_all(); + nbcon_atomic_flush_pending(); + |