* [PATCH v2] tty: serial: msm_serial: avoid system lockup condition
@ 2019-06-10 7:55 Jorge Ramirez-Ortiz
2019-06-10 17:05 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Jorge Ramirez-Ortiz @ 2019-06-10 7:55 UTC (permalink / raw)
To: jorge.ramirez-ortiz, agross, david.brown, gregkh, jslaby
Cc: linux-arm-msm, linux-serial, linux-kernel, khasim.mohammed,
bjorn.andersson
The function msm_wait_for_xmitr can be taken with interrupts
disabled. In order to avoid a potential system lockup - demonstrated
under stress testing conditions on SoC QCS404/5 - make sure we wait
for a bounded amount of time.
Tested on SoC QCS404.
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
---
drivers/tty/serial/msm_serial.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
index 23833ad952ba..3657a24913fc 100644
--- a/drivers/tty/serial/msm_serial.c
+++ b/drivers/tty/serial/msm_serial.c
@@ -383,10 +383,14 @@ static void msm_request_rx_dma(struct msm_port *msm_port, resource_size_t base)
static inline void msm_wait_for_xmitr(struct uart_port *port)
{
+ unsigned int timeout = 500000;
+
while (!(msm_read(port, UART_SR) & UART_SR_TX_EMPTY)) {
if (msm_read(port, UART_ISR) & UART_ISR_TX_READY)
break;
udelay(1);
+ if (!timeout--)
+ break;
}
msm_write(port, UART_CR_CMD_RESET_TX_READY, UART_CR);
}
--
2.21.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] tty: serial: msm_serial: avoid system lockup condition
2019-06-10 7:55 [PATCH v2] tty: serial: msm_serial: avoid system lockup condition Jorge Ramirez-Ortiz
@ 2019-06-10 17:05 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2019-06-10 17:05 UTC (permalink / raw)
To: Jorge Ramirez-Ortiz
Cc: agross, david.brown, jslaby, linux-arm-msm, linux-serial,
linux-kernel, khasim.mohammed, bjorn.andersson
On Mon, Jun 10, 2019 at 09:55:54AM +0200, Jorge Ramirez-Ortiz wrote:
> The function msm_wait_for_xmitr can be taken with interrupts
> disabled. In order to avoid a potential system lockup - demonstrated
> under stress testing conditions on SoC QCS404/5 - make sure we wait
> for a bounded amount of time.
>
> Tested on SoC QCS404.
>
> Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
> ---
> drivers/tty/serial/msm_serial.c | 4 ++++
> 1 file changed, 4 insertions(+)
What changed from v1? Always put that below the --- line.
v3 please.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-06-10 17:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-10 7:55 [PATCH v2] tty: serial: msm_serial: avoid system lockup condition Jorge Ramirez-Ortiz
2019-06-10 17:05 ` Greg KH
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).