Skip to contentSkip to conversation

imx-serial: RX DMA startup latency

PATCH Fabio Estevam 2 participants 5 messages Jul 12, 2017 – Jul 13, 2017

Subsystems (3)
lore
Share & tools
lore

Fabio Estevam

author reviewer
#0 lore raw

From: Peter Senna Tschudin <[email protected]>

commit 4dec2f119e86f9c91e60cdd8f0cc057452e331a9 upstream.

18a4208 introduced a change to reduce the RX DMA latency on the first reception when the serial port was opened for reading. However it was claiming a hardirq unsafe lock after a hardirq safe lock which is not allowed and causes lockdep to complain verbosely.

This patch changes the code to always start RX DMA earlier, instead of relying on the flags used to open the serial port removing the code that was looking for the serial file flags.

---
 drivers/tty/serial/imx.c | 26 +++++---------------------
 1 file changed, 5 insertions(+), 21 deletions(-)
drivers/tty/serial/imx.c +5 -21
index 33509b4..64e16b3 100644
@@ -1340,29 +1340,13 @@ static int imx_startup(struct uart_port *port)
 	imx_enable_ms(&sport->port);
 
 	/*
-	 * If the serial port is opened for reading start RX DMA immediately
-	 * instead of waiting for RX FIFO interrupts. In our iMX53 the average
-	 * delay for the first reception dropped from approximately 35000
-	 * microseconds to 1000 microseconds.
+	 * Start RX DMA immediately instead of waiting for RX FIFO interrupts.
+	 * In our iMX53 the average delay for the first reception dropped from
+	 * approximately 35000 microseconds to 1000 microseconds.
 	 */
 	if (sport->dma_is_enabled) {
-		struct tty_struct *tty = sport->port.state->port.tty;
-		struct tty_file_private *file_priv;
-		int readcnt = 0;
-
-		spin_lock(&tty->files_lock);
-
-		if (!list_empty(&tty->tty_files))
-			list_for_each_entry(file_priv, &tty->tty_files, list)
-				if (!(file_priv->file->f_flags & O_WRONLY))
-					readcnt++;
-
-		spin_unlock(&tty->files_lock);
-
-		if (readcnt > 0) {
-			imx_disable_rx_int(sport);
-			start_rx_dma(sport);
-		}
+		imx_disable_rx_int(sport);
+		start_rx_dma(sport);
 	}
 
 	spin_unlock_irqrestore(&sport->port.lock, flags);
Signature · 1 line
cgit v1.1
#1 lore raw
Quoted 13 lines · Fabio Estevam

From: Peter Senna Tschudin <[email protected]>

commit 4dec2f119e86f9c91e60cdd8f0cc057452e331a9 upstream.

18a4208 introduced a change to reduce the RX DMA latency on the first reception when the serial port was opened for reading. However it was claiming a hardirq unsafe lock after a hardirq safe lock which is not allowed and causes lockdep to complain verbosely.

This patch changes the code to always start RX DMA earlier, instead of relying on the flags used to open the serial port removing the code that was looking for the serial file flags.

Quoted 8 lines
---
 drivers/tty/serial/imx.c | 26 +++++---------------------
 1 file changed, 5 insertions(+), 21 deletions(-)

What are you asking for here, for this to be added to the 4.12-stable tree?

Or something else?

Please always be explicit...

thanks,

greg k-h

author reviewer
#2 lore raw

Hi Greg,

Quoted 23 lines · Greg Kroah-Hartman
Quoted 13 lines · Fabio Estevam

From: Peter Senna Tschudin <[email protected]>

commit 4dec2f119e86f9c91e60cdd8f0cc057452e331a9 upstream.

18a4208 introduced a change to reduce the RX DMA latency on the first reception when the serial port was opened for reading. However it was claiming a hardirq unsafe lock after a hardirq safe lock which is not allowed and causes lockdep to complain verbosely.

This patch changes the code to always start RX DMA earlier, instead of relying on the flags used to open the serial port removing the code that was looking for the serial file flags.

Quoted 8 lines
---
 drivers/tty/serial/imx.c | 26 +++++---------------------
 1 file changed, 5 insertions(+), 21 deletions(-)
Quoted 2 lines

What are you asking for here, for this to be added to the 4.12-stable tree?

Yes, correct.

I thought that adding "Cc: <[email protected]> #4.12.x" would make it clear.

What should I have made differently?

Thanks

#3 lore raw
Quoted 27 lines · Fabio Estevam

Hi Greg,

Quoted 23 lines · Greg Kroah-Hartman
Quoted 21 lines · Fabio Estevam

From: Peter Senna Tschudin <[email protected]>

commit 4dec2f119e86f9c91e60cdd8f0cc057452e331a9 upstream.

18a4208 introduced a change to reduce the RX DMA latency on the first reception when the serial port was opened for reading. However it was claiming a hardirq unsafe lock after a hardirq safe lock which is not allowed and causes lockdep to complain verbosely.

This patch changes the code to always start RX DMA earlier, instead of relying on the flags used to open the serial port removing the code that was looking for the serial file flags.

---
 drivers/tty/serial/imx.c | 26 +++++---------------------
 1 file changed, 5 insertions(+), 21 deletions(-)
Quoted 7 lines
Quoted 2 lines

What are you asking for here, for this to be added to the 4.12-stable tree?

Yes, correct.

I thought that adding "Cc: <[email protected]> #4.12.x" would make it clear.

That makes it look like any other patch being submitted upstream.

Quoted 1 line

What should I have made differently?

Below the --- line, say "Can you apply this patch to...", or even simpler yet, just a short email saying, "Can you apply commit XXXXXX to the 4.12-stable tree?"

anyway, will go queue this up now, thanks.

greg k-h

author reviewer
#4 lore raw
Quoted 3 lines · Greg Kroah-Hartman

Below the --- line, say "Can you apply this patch to...", or even simpler yet, just a short email saying, "Can you apply commit XXXXXX to the 4.12-stable tree?"

Thanks for the clarification. Will do like this next time.

Quoted 1 line

anyway, will go queue this up now, thanks.

Thanks!