Skip to contentSkip to conversation

tty/serial/sifive: Make the locking RT aware

PATCH In review [email protected] 3 participants 5 messages Dec 3, 2024 – Dec 6, 2024

Subsystems (2)
lore
Share & tools
lore
#1 lore raw
In reply to [email protected]
Quoted 4 lines · On 2024-12-03 17:40:09 [+0800], [email protected] wrote:

From: Tan En De <[email protected]>

The lock is a sleeping lock and local_irq_save() is not the optimsation we are looking for. Redo it to make it work on -RT and non-RT.

You need to state which kernel this needs to be applied to.
The change you looking for is
32c694ec3efc2 ("serial: sifive: Use uart_prepare_sysrq_char() to handle sysrq.")

Quoted 2 lines

Sebastian

#0 lore raw

PATCH 1/1 tty/serial/sifive: Make the locking RT aware

From: Tan En De <[email protected]>

The lock is a sleeping lock and local_irq_save() is not the optimsation we are looking for. Redo it to make it work on -RT and non-RT.

---
 drivers/tty/serial/sifive.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/tty/serial/sifive.c +4 -8
index b296e57a9dee..074c9f392634 100644
@@ -791,13 +791,10 @@ static void sifive_serial_console_write(struct console *co, const char *s,
 	if (!ssp)
 		return;
 
-	local_irq_save(flags);
-	if (ssp->port.sysrq)
-		locked = 0;
-	else if (oops_in_progress)
-		locked = uart_port_trylock(&ssp->port);
+	if (ssp->port.sysrq || oops_in_progress)
+		locked = uart_port_trylock_irqsave(&ssp->port, &flags);
 	else
-		uart_port_lock(&ssp->port);
+		uart_port_lock_irqsave(&ssp->port, &flags);
 
 	ier = __ssp_readl(ssp, SIFIVE_SERIAL_IE_OFFS);
 	__ssp_writel(0, SIFIVE_SERIAL_IE_OFFS, ssp);
@@ -807,8 +804,7 @@ static void sifive_serial_console_write(struct console *co, const char *s,
 	__ssp_writel(ier, SIFIVE_SERIAL_IE_OFFS, ssp);
 
 	if (locked)
-		uart_port_unlock(&ssp->port);
-	local_irq_restore(flags);
+		uart_port_unlock_irqrestore(&ssp->port, flags);
 }
 
 static int sifive_serial_console_setup(struct console *co, char *options)
Signature · 1 line
2.34.1
author
#2 lore raw
In reply to Sebastian Andrzej Siewior
Quoted 5 lines

-----Original Message-----
You need to state which kernel this needs to be applied to. The change you looking for is
32c694ec3efc2 ("serial: sifive: Use uart_prepare_sysrq_char() to
handle sysrq.")

Thanks for pointing this out, I overlooked the commit in the mainline kernel. BTW, the commit is not in v6.6.63-rt46-rebase.

#3 lore raw
Quoted 8 lines · EnDe Tan
Quoted 5 lines

-----Original Message-----
You need to state which kernel this needs to be applied to. The change you looking for is
32c694ec3efc2 ("serial: sifive: Use uart_prepare_sysrq_char() to
handle sysrq.")

Thanks for pointing this out, I overlooked the commit in the mainline kernel. BTW, the commit is not in v6.6.63-rt46-rebase.

Indeed. Clark, could you please backport
32c694ec3efc2 serial: sifive: Use uart_prepare_sysrq_char() to handle sysrq.

for v6.6-RT?

Sebastian

#4 lore raw

yes, I'll put it in my pending RC

Quoted 18 lines · Sebastian Andrzej Siewior
Quoted 8 lines · EnDe Tan
Quoted 5 lines

-----Original Message-----
You need to state which kernel this needs to be applied to. The change you looking for is
32c694ec3efc2 ("serial: sifive: Use uart_prepare_sysrq_char() to
handle sysrq.")

Thanks for pointing this out, I overlooked the commit in the mainline kernel. BTW, the commit is not in v6.6.63-rt46-rebase.

Indeed. Clark, could you please backport
32c694ec3efc2 serial: sifive: Use uart_prepare_sysrq_char() to handle sysrq.

for v6.6-RT?

Sebastian