From: Dave Martin <Dave.Martin@arm.com>
To: linux-serial@vger.kernel.org
Cc: "Russell King" <linux@arm.linux.org.uk>,
"Jakub Kiciński" <moorray3@wp.pl>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Andrew Jackson" <Andrew.Jackson@arm.com>,
"Graeme Gregory" <gg@slimlogic.co.uk>,
"Andre Przywara" <Andre.Przywara@arm.com>,
"popcorn mix" <popcornmix@gmail.com>,
"Jorge Ramirez-Ortiz" <jorge.ramirez-ortiz@linaro.org>,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 REPOST] Revert "serial/amba-pl011: Leave the TX IRQ alone when the UART is not open"
Date: Fri, 8 May 2015 14:07:50 +0100 [thread overview]
Message-ID: <1431090470-1394-1-git-send-email-Dave.Martin@arm.com> (raw)
This reverts commit f2ee6dfa0e8597eea8b98d240b0033994e20d215.
Jakub Kiciński observed that this patch can cause the pl011
driver to hang if if the only process with a pl011 port open is
killed by a signal, pl011_shutdown() can get called with an
arbitrary amount of data still in the FIFO.
Calling _shutdown() with the TX FIFO non-empty is questionable
behaviour and my itself be a bug.
Since the affected patch was speculative anyway, and brings limited
benefit, the simplest course is to remove the assumption that TXIS
will always be left asserted after the port is shut down.
Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/tty/serial/amba-pl011.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
The original patch was a misguided optimisation and introduces a bug
that can lead to driver deadlock. Some people are hitting this in
v4.0-rc1/2.
The revert is straightfoward: please consider applying it for v4.1.
This revert has already been posted to linux-serial and applied in
tty-next, but is not yet scheduled for v4.1.
Thanks
---Dave
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 5a4e9d5..6f5a072 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -1639,6 +1639,9 @@ static int pl011_startup(struct uart_port *port)
writew(uap->vendor->ifls, uap->port.membase + UART011_IFLS);
+ /* Assume that TX IRQ doesn't work until we see one: */
+ uap->tx_irq_seen = 0;
+
spin_lock_irq(&uap->port.lock);
/* restore RTS and DTR */
@@ -1702,7 +1705,7 @@ static void pl011_shutdown(struct uart_port *port)
spin_lock_irq(&uap->port.lock);
uap->im = 0;
writew(uap->im, uap->port.membase + UART011_IMSC);
- writew(0xffff & ~UART011_TXIS, uap->port.membase + UART011_ICR);
+ writew(0xffff, uap->port.membase + UART011_ICR);
spin_unlock_irq(&uap->port.lock);
pl011_dma_shutdown(uap);
--
1.7.10.4
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2015-05-08 13:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-08 13:07 Dave Martin [this message]
2015-05-11 16:09 ` [PATCH v4 REPOST] Revert "serial/amba-pl011: Leave the TX IRQ alone when the UART is not open" Andre Przywara
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=1431090470-1394-1-git-send-email-Dave.Martin@arm.com \
--to=dave.martin@arm.com \
--cc=Andre.Przywara@arm.com \
--cc=Andrew.Jackson@arm.com \
--cc=gg@slimlogic.co.uk \
--cc=gregkh@linuxfoundation.org \
--cc=jorge.ramirez-ortiz@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-serial@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=moorray3@wp.pl \
--cc=popcornmix@gmail.com \
/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).