[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87vb42gbt3.fsf@linutronix.de>
Date: Thu, 31 Mar 2016 12:51:36 +0200
From: John Ogness <john.ogness@...utronix.de>
To: Peter Hurley <peter@...leysoftware.com>
Cc: Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Tony Lindgren <tony@...mide.com>, nsekhar@...com,
linux-kernel@...r.kernel.org, linux-serial@...r.kernel.org,
linux-omap@...r.kernel.org
Subject: Re: [PATCH] tty: serial: 8250_omap: do not defer termios changes
On 2016-03-31, John Ogness <john.ogness@...utronix.de> wrote:
> diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
> index 6f76051..9459b4d 100644
> --- a/drivers/tty/serial/8250/8250_omap.c
> +++ b/drivers/tty/serial/8250/8250_omap.c
> @@ -460,6 +451,24 @@ static void omap_8250_set_termios(struct uart_port *port,
> priv->efr |= OMAP_UART_SW_TX;
> }
> }
> +
> + if (dma && dma->tx_running) {
> + /*
> + * TCSANOW requests the change to occur immediately, however
> + * if we have a TX-DMA operation in progress then it has been
> + * observed that it might stall and never complete. Therefore
> + * we wait until DMA completes to prevent this hang from
> + * happening.
> + */
> +
> + dma->tx_running = 2;
> +
> + spin_unlock_irq(&up->port.lock);
> + wait_event_interruptible(priv->termios_wait,
> + dma->tx_running == 3);
> + spin_lock_irq(&up->port.lock);
> + complete_dma = 1;
> + }
Sorry, I just realized that wait_event_interruptible() is used
here. IMHO this should be changed to wait_event(), otherwise a signal
could trigger the TX-DMA deadlock this code is trying to prevent.
If hardware flow control is active, it is possible that wait_event()
leads to the caller waiting forever. But allowing interruptible causes
too many problems since set_termios() cannot communicate errors.
John Ogness
Powered by blists - more mailing lists