[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAF6AEGuAPurGcRh42iRkt3paD=kWLJw-ic_LL1QGY=ws8_00XA@mail.gmail.com>
Date: Mon, 10 Jun 2019 10:53:09 -0700
From: Rob Clark <robdclark@...il.com>
To: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@...aro.org>
Cc: Greg KH <gregkh@...uxfoundation.org>, agross@...nel.org,
David Brown <david.brown@...aro.org>, jslaby@...e.com,
linux-arm-msm <linux-arm-msm@...r.kernel.org>,
linux-serial@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
khasim.mohammed@...aro.org,
Bjorn Andersson <bjorn.andersson@...aro.org>
Subject: Re: [PATCH v3] tty: serial: msm_serial: avoid system lockup condition
On Mon, Jun 10, 2019 at 10:23 AM Jorge Ramirez-Ortiz
<jorge.ramirez-ortiz@...aro.org> 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@...aro.org>
I had observed that heavy UART traffic would lockup the system (on
sdm845, but I guess same serial driver)?
But a comment from the peanut gallary: wouldn't this fix lead to TX
corruption, ie. writing more into TX fifo before hw is ready? I
haven't looked closely at the driver, but a way to wait without irqs
disabled would seem nicer..
BR,
-R
> ---
> v2: fix exit condition (timeout --> !timeout)
> v3: add these clarification messages
>
> 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
>
Powered by blists - more mailing lists