Re: [PATCH] tty: serial: 8250_omap: do not defer termios changes

From
John Ogness <john.ogness@linutronix.de>
Date
2016-03-31 10:51:43
Also in
linux-omap, lkml
On 2016-03-31, John Ogness [off-list ref] wrote:
quoted hunk
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
Thread (1 message) 1 message, 1 author, last reply 2016-03-31
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help