From: ende.tan@starfivetech.com
To: linux-kernel@vger.kernel.org
Cc: bigeasy@linutronix.de, tglx@linutronix.de, rostedt@goodmis.org,
linux-rt-users@vger.kernel.org, leyfoon.tan@starfivetech.com,
endeneer@gmail.com, Tan En De <ende.tan@starfivetech.com>
Subject: [RT,1/1] tty/serial/sifive: Make the locking RT aware
Date: Tue, 3 Dec 2024 17:40:09 +0800 [thread overview]
Message-ID: <20241203094009.67697-1-ende.tan@starfivetech.com> (raw)
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
next reply other threads:[~2024-12-03 20:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-03 9:40 ende.tan [this message]
2024-12-03 10:36 ` [RT,1/1] tty/serial/sifive: Make the locking RT aware 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241203094009.67697-1-ende.tan@starfivetech.com \
--to=ende.tan@starfivetech.com \
--cc=bigeasy@linutronix.de \
--cc=endeneer@gmail.com \
--cc=leyfoon.tan@starfivetech.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox