summaryrefslogtreecommitdiffstats
path: root/debian/patches-rt/0018-serial-pch-Use-uart_prepare_sysrq_char.patch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 18:50:40 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 18:50:59 +0000
commitba6b167af6ee5e63ca79ad22e7719644aed12b2c (patch)
tree62272cbe2fb256ecb90fa6e2cbfa509541954d28 /debian/patches-rt/0018-serial-pch-Use-uart_prepare_sysrq_char.patch
parentMerging upstream version 6.8.9. (diff)
downloadlinux-ba6b167af6ee5e63ca79ad22e7719644aed12b2c.tar.xz
linux-ba6b167af6ee5e63ca79ad22e7719644aed12b2c.zip
Merging debian version 6.8.9-1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches-rt/0018-serial-pch-Use-uart_prepare_sysrq_char.patch')
-rw-r--r--debian/patches-rt/0018-serial-pch-Use-uart_prepare_sysrq_char.patch79
1 files changed, 79 insertions, 0 deletions
diff --git a/debian/patches-rt/0018-serial-pch-Use-uart_prepare_sysrq_char.patch b/debian/patches-rt/0018-serial-pch-Use-uart_prepare_sysrq_char.patch
new file mode 100644
index 0000000000..55e6615c9e
--- /dev/null
+++ b/debian/patches-rt/0018-serial-pch-Use-uart_prepare_sysrq_char.patch
@@ -0,0 +1,79 @@
+From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+Date: Fri, 1 Mar 2024 22:45:31 +0100
+Subject: [PATCH 18/18] serial: pch: Use uart_prepare_sysrq_char().
+Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/6.8/older/patches-6.8.2-rt11.tar.xz
+
+The port lock is a spinlock_t which is becomes a sleeping lock on PREEMPT_RT.
+The driver splits the locking function into two parts: local_irq_save() and
+uart_port_lock() and this breaks PREEMPT_RT.
+
+Delay handling sysrq until port lock is dropped.
+Remove the special case in the console write routine an always use the
+complete locking function.
+
+Link: https://lore.kernel.org/r/20240301215246.891055-19-bigeasy@linutronix.de
+Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+---
+ drivers/tty/serial/pch_uart.c | 24 +++++++++---------------
+ 1 file changed, 9 insertions(+), 15 deletions(-)
+
+--- a/drivers/tty/serial/pch_uart.c
++++ b/drivers/tty/serial/pch_uart.c
+@@ -564,7 +564,7 @@ static int pch_uart_hal_read(struct eg20
+ if (uart_handle_break(port))
+ continue;
+ }
+- if (uart_handle_sysrq_char(port, rbr))
++ if (uart_prepare_sysrq_char(port, rbr))
+ continue;
+
+ buf[i++] = rbr;
+@@ -1070,7 +1070,7 @@ static irqreturn_t pch_uart_interrupt(in
+ handled |= (unsigned int)ret;
+ }
+
+- uart_port_unlock(&priv->port);
++ uart_unlock_and_check_sysrq(&priv->port);
+ return IRQ_RETVAL(handled);
+ }
+
+@@ -1550,22 +1550,17 @@ pch_console_write(struct console *co, co
+ {
+ struct eg20t_port *priv;
+ unsigned long flags;
+- int port_locked = 1;
++ int locked = 1;
+ u8 ier;
+
+ priv = pch_uart_ports[co->index];
+
+ touch_nmi_watchdog();
+
+- local_irq_save(flags);
+- if (priv->port.sysrq) {
+- /* serial8250_handle_port() already took the port lock */
+- port_locked = 0;
+- } else if (oops_in_progress) {
+- port_locked = uart_port_trylock(&priv->port);
+- } else {
+- uart_port_lock(&priv->port);
+- }
++ if (oops_in_progress)
++ locked = uart_port_trylock_irqsave(&priv->port, &flags);
++ else
++ uart_port_lock_irqsave(&priv->port, &flags);
+
+ /*
+ * First save the IER then disable the interrupts
+@@ -1583,9 +1578,8 @@ pch_console_write(struct console *co, co
+ wait_for_xmitr(priv, UART_LSR_BOTH_EMPTY);
+ iowrite8(ier, priv->membase + UART_IER);
+
+- if (port_locked)
+- uart_port_unlock(&priv->port);
+- local_irq_restore(flags);
++ if (locked)
++ uart_port_unlock_irqrestore(&priv->port, flags);
+ }
+
+ static int __init pch_console_setup(struct console *co, char *options)