public inbox for linux-rt-users@vger.kernel.org
 help / color / mirror / Atom feed
* [RT,1/1] tty/serial/sifive: Make the locking RT aware
@ 2024-12-03  9:40 ende.tan
  2024-12-03 10:36 ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 5+ messages in thread
From: ende.tan @ 2024-12-03  9:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: bigeasy, tglx, rostedt, linux-rt-users, leyfoon.tan, endeneer,
	Tan En De

From: Tan En De <ende.tan@starfivetech.com>

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.

Signed-off-by: Tan En De <ende.tan@starfivetech.com>
Signed-off-by: Tan Ley Foon <leyfoon.tan@starfivetech.com>
---
 drivers/tty/serial/sifive.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/tty/serial/sifive.c b/drivers/tty/serial/sifive.c
index b296e57a9dee..074c9f392634 100644
--- a/drivers/tty/serial/sifive.c
+++ b/drivers/tty/serial/sifive.c
@@ -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)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [RT,1/1] tty/serial/sifive: Make the locking RT aware
  2024-12-03  9:40 [RT,1/1] tty/serial/sifive: Make the locking RT aware ende.tan
@ 2024-12-03 10:36 ` Sebastian Andrzej Siewior
  2024-12-04 15:24   ` EnDe Tan
  0 siblings, 1 reply; 5+ messages in thread
From: Sebastian Andrzej Siewior @ 2024-12-03 10:36 UTC (permalink / raw)
  To: ende.tan; +Cc: linux-kernel, tglx, rostedt, linux-rt-users, leyfoon.tan,
	endeneer

On 2024-12-03 17:40:09 [+0800], ende.tan@starfivetech.com wrote:
> From: Tan En De <ende.tan@starfivetech.com>
> 
> 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.")

> Signed-off-by: Tan En De <ende.tan@starfivetech.com>
> Signed-off-by: Tan Ley Foon <leyfoon.tan@starfivetech.com>

Sebastian

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [RT,1/1] tty/serial/sifive: Make the locking RT aware
  2024-12-03 10:36 ` Sebastian Andrzej Siewior
@ 2024-12-04 15:24   ` EnDe Tan
  2024-12-05  8:06     ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 5+ messages in thread
From: EnDe Tan @ 2024-12-04 15:24 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de,
	rostedt@goodmis.org, linux-rt-users@vger.kernel.org, Leyfoon Tan,
	endeneer@gmail.com

> -----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. 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: RE: [RT,1/1] tty/serial/sifive: Make the locking RT aware
  2024-12-04 15:24   ` EnDe Tan
@ 2024-12-05  8:06     ` Sebastian Andrzej Siewior
  2024-12-06 16:30       ` Clark Williams
  0 siblings, 1 reply; 5+ messages in thread
From: Sebastian Andrzej Siewior @ 2024-12-05  8:06 UTC (permalink / raw)
  To: EnDe Tan, stable-rt, Clark Williams
  Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de,
	rostedt@goodmis.org, linux-rt-users@vger.kernel.org, Leyfoon Tan,
	endeneer@gmail.com

On 2024-12-04 15:24:38 [+0000], EnDe Tan wrote:
> > -----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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: RE: [RT,1/1] tty/serial/sifive: Make the locking RT aware
  2024-12-05  8:06     ` Sebastian Andrzej Siewior
@ 2024-12-06 16:30       ` Clark Williams
  0 siblings, 0 replies; 5+ messages in thread
From: Clark Williams @ 2024-12-06 16:30 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: EnDe Tan, stable-rt, linux-kernel@vger.kernel.org,
	tglx@linutronix.de, rostedt@goodmis.org,
	linux-rt-users@vger.kernel.org, Leyfoon Tan, endeneer@gmail.com

yes, I'll put it in my pending RC

On Thu, Dec 5, 2024 at 8:06 AM Sebastian Andrzej Siewior
<bigeasy@linutronix.de> wrote:
>
> On 2024-12-04 15:24:38 [+0000], EnDe Tan wrote:
> > > -----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
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-12-06 16:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-03  9:40 [RT,1/1] tty/serial/sifive: Make the locking RT aware ende.tan
2024-12-03 10:36 ` Sebastian Andrzej Siewior
2024-12-04 15:24   ` EnDe Tan
2024-12-05  8:06     ` Sebastian Andrzej Siewior
2024-12-06 16:30       ` Clark Williams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox