Skip to contentSkip to conversation

Revert "serial: 8250_port: Drop duplicate NULL check"

PATCH In review Ferry Toth 5 participants 5 messages Oct 10 – Oct 12

Subsystems (2)
lore
Share & tools
lore

Ferry Toth

author
#0 lore raw

PATCH 1/1 Revert "serial: 8250_port: Drop duplicate NULL check"

This reverts commit 7885af04df6e4efd72910200c1bfc079d61202e4.

Commit 7885af04df6e ("serial: 8250_port: Drop duplicate NULL check") added up->dma = NULL; to serial8250_release_dma(), with the stated intent of making sure DMA would not be used again after release.

However, up->dma is assigned once at probe time. serial8250_do_startup() only calls serial8250_request_dma() when up->dma is non-NULL, so after the first close the pointer stays NULL and DMA is never re-acquired.

On Intel Tangier (Edison) with HSU DMA this causes a regression: the first port open uses TX DMA, the second and later opens transmit in PIO mode, producing 64-byte FIFO bursts with ~50us gaps between them.

Fixes 7885af04df6e ("serial: 8250_port: Drop duplicate NULL check")
---
 drivers/tty/serial/8250/8250_port.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/serial/8250/8250_port.c +2 -2
index 38fa45e74a37..19d0663ee756 100644
@@ -2428,8 +2428,8 @@ void serial8250_do_shutdown(struct uart_port *port)
 
 	synchronize_irq(port->irq);
 
-	serial8250_release_dma(up);
-	up->dma = NULL;
+	if (up->dma)
+		serial8250_release_dma(up);
 
 	scoped_guard(uart_port_lock_irqsave, port) {
 		if (port->flags & UPF_FOURPORT) {
Signature · 1 line
2.53.0
#1 lore raw
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 10 lines

This reverts commit 7885af04df6e4efd72910200c1bfc079d61202e4.

Commit 7885af04df6e ("serial: 8250_port: Drop duplicate NULL check") added up->dma = NULL; to serial8250_release_dma(), with the stated intent of making sure DMA would not be used again after release.

However, up->dma is assigned once at probe time. serial8250_do_startup() only calls serial8250_request_dma() when up->dma is non-NULL, so after the first close the pointer stays NULL and DMA is never re-acquired.

Quoted 7 lines

On Intel Tangier (Edison) with HSU DMA this causes a regression: the first port open uses TX DMA, the second and later opens transmit in PIO mode, producing 64-byte FIFO bursts with ~50us gaps between them.

Fixes 7885af04df6e ("serial: 8250_port: Drop duplicate NULL check")

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#2 lore raw
In reply to Ferry Toth
Quoted 6 lines · Ferry Toth

This reverts commit 7885af04df6e4efd72910200c1bfc079d61202e4.

Commit 7885af04df6e ("serial: 8250_port: Drop duplicate NULL check") added up->dma = NULL; to serial8250_release_dma(), with the stated intent of making sure DMA would not be used again after release.

Quoted 7 lines

However, up->dma is assigned once at probe time. serial8250_do_startup() only calls serial8250_request_dma() when up->dma is non-NULL, so after the first close the pointer stays NULL and DMA is never re-acquired.

On Intel Tangier (Edison) with HSU DMA this causes a regression: the first port open uses TX DMA, the second and later opens transmit in PIO mode, producing 64-byte FIFO bursts with ~50us gaps between them.

Ugh, sorry about missing that. I'll queue this up when I get a chance in the next few days, thanks for posting it.

greg k-h

#3 lore raw

Hi

Op 11-10-2026 om 07:35 schreef Greg Kroah-Hartman:

Quoted 11 lines · Ferry Toth
Quoted 10 lines

This reverts commit 7885af04df6e4efd72910200c1bfc079d61202e4.

Commit 7885af04df6e ("serial: 8250_port: Drop duplicate NULL check") added up->dma = NULL; to serial8250_release_dma(), with the stated intent of making sure DMA would not be used again after release.

However, up->dma is assigned once at probe time. serial8250_do_startup() only calls serial8250_request_dma() when up->dma is non-NULL, so after the first close the pointer stays NULL and DMA is never re-acquired.

Quoted 7 lines
Quoted 3 lines

On Intel Tangier (Edison) with HSU DMA this causes a regression: the first port open uses TX DMA, the second and later opens transmit in PIO mode, producing 64-byte FIFO bursts with ~50us gaps between them.

Ugh, sorry about missing that. I'll queue this up when I get a chance in the next few days, thanks for posting it.

greg k-h

No worries, sorry I found it this late. I have been behind testing kernels and only now trying to catch up.

Ferry

Acked-by on v1 1/1
#4 lore raw
In reply to Ferry Toth
Quoted 6 lines · Ferry Toth

This reverts commit 7885af04df6e4efd72910200c1bfc079d61202e4.

Commit 7885af04df6e ("serial: 8250_port: Drop duplicate NULL check") added up->dma = NULL; to serial8250_release_dma(), with the stated intent of making sure DMA would not be used again after release.

Quoted 7 lines

However, up->dma is assigned once at probe time. serial8250_do_startup() only calls serial8250_request_dma() when up->dma is non-NULL, so after the first close the pointer stays NULL and DMA is never re-acquired.

On Intel Tangier (Edison) with HSU DMA this causes a regression: the first port open uses TX DMA, the second and later opens transmit in PIO mode, producing 64-byte FIFO bursts with ~50us gaps between them.

As discussed off-list with Ferry the culprit patch was inspired by 8250_omap implementation which may have the same bug lurking. Thanks, Ferry, for a good catch!

Signature · 2 lines
With Best Regards,
Andy Shevchenko