From: Lukas Wunner <lukas@wunner.de>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jslaby@suse.com>
Cc: "Matwey V. Kornilov" <matwey@sai.msu.ru>,
Heiko Schocher <hs@denx.de>,
Giulio Benetti <giulio.benetti@micronovasrl.com>,
Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>,
Stefan Wahren <wahrenst@gmx.net>,
Martin Sperl <kernel@martin.sperl.org>,
Heiko Stuebner <heiko@sntech.de>,
linux-serial@vger.kernel.org
Subject: [PATCH tty-next 2/2] serial: 8250: Optimize irq enable after console write
Date: Thu, 26 Mar 2020 13:20:16 +0100 [thread overview]
Message-ID: <96f915a678051faf9e14c9391a069339e6c62bd6.1585224378.git.lukas@wunner.de> (raw)
In-Reply-To: <b420d9c3b1c8b0492db55cc6f62076bfd9968b2f.1585224378.git.lukas@wunner.de>
Commit 6194c38fc20d ("serial: 8250: Support console on software emulated
rs485 ports") amended serial8250_console_write() with rs485 support, but
positioned the invocation of ->rs485_stop_tx() after re-enablement of
interrupts. The irq handler and ->console_write() are serialized with
the port spinlock, so no problem there, but due to the rs485 delay, the
irq handler may unnecessarily spin for a while. Avoid that by moving
->rs485_stop_tx() before re-enablement of interrupts, which also mirrors
the order at the beginning of serial8250_console_write().
Signed-off-by: Lukas Wunner <lukas@wunner.de>
---
drivers/tty/serial/8250/8250_port.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index a1d3aef3c406..f77bf820b7a3 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -3268,7 +3268,6 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s,
* and restore the IER
*/
wait_for_xmitr(up, BOTH_EMPTY);
- serial_port_out(port, UART_IER, ier);
if (em485) {
mdelay(port->rs485.delay_rts_after_send);
@@ -3276,6 +3275,8 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s,
up->rs485_stop_tx(up);
}
+ serial_port_out(port, UART_IER, ier);
+
/*
* The receive handling will happen properly because the
* receive ready bit will still be set; it is not cleared
--
2.25.0
next prev parent reply other threads:[~2020-03-26 12:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-26 12:20 [PATCH tty-next 1/2] serial: 8250: Fix rs485 delay after console write Lukas Wunner
2020-03-26 12:20 ` Lukas Wunner [this message]
2020-03-26 14:40 ` Greg Kroah-Hartman
2020-03-26 15:05 ` Lukas Wunner
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=96f915a678051faf9e14c9391a069339e6c62bd6.1585224378.git.lukas@wunner.de \
--to=lukas@wunner.de \
--cc=giulio.benetti@micronovasrl.com \
--cc=gregkh@linuxfoundation.org \
--cc=heiko@sntech.de \
--cc=hs@denx.de \
--cc=jslaby@suse.com \
--cc=kernel@martin.sperl.org \
--cc=linux-serial@vger.kernel.org \
--cc=matwey@sai.msu.ru \
--cc=u.kleine-koenig@pengutronix.de \
--cc=wahrenst@gmx.net \
/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;
as well as URLs for NNTP newsgroup(s).