tty: drop low-latency workarounds
Subsystems (18)
cover tty: drop low-latency workarounds
The infamous low_latency behaviour of tty_flip_buffer_push(), which meant that data could be pushed to the line discipline immediately instead of being deferred to a work queue, was finally removed in 2014.
Since then there's no need for drivers to keep hacks to temporarily drop the port lock during receive processing but this pattern has been reproduced in later added drivers nonetheless.
Note that several of these workarounds were added by a series posted in 2013, which ended up being merged despite having completely nonsensical commit messages. As it turned out, it was just the RT patch set which effectively enabled the low_latency flag for serial drivers that did not handle it.
There's of course nothing wrong releasing the port lock before calling tty_flip_buffer_push(), and some drivers still do after this series, but let's get rid of the completely unnecessary unlock-and-reacquire pattern.
Johan
Johan Hovold (26):
tty: mxser: drop low-latency workaround
serial: altera_jtaguart: drop low-latency workaround
serial: altera_uart: drop low-latency workaround
serial: amba-pl010: drop low-latency workaround
serial: amba-pl011: drop low-latency workaround
serial: apbuart: drop low-latency workaround
serial: ar933x: drop low-latency workaround
serial: arc_uart: drop low-latency workaround
serial: atmel_serial: drop low-latency workaround
serial: bcm63xx: drop low-latency workaround
serial: icom: drop low-latency workaround
serial: lpc32xx_hs: drop low-latency workaround
serial: mcf: drop low-latency workaround
serial: meson: drop low-latency workaround
serial: mpc52xx_uart: drop low-latency workaround
serial: msm_serial: drop low-latency workaround
serial: owl: drop low-latency workaround
serial: rda: drop low-latency workaround
serial: rp2: drop low-latency workaround
serial: sa1100: drop low-latency workaround
serial: txx9: drop low-latency workaround
serial: sifive: drop low-latency workaround
serial: sunsu: drop low-latency workaround
serial: timbuart: drop low-latency workaround
serial: vt8500: drop low-latency workaround
serial: xilinx_uartps: drop low-latency workaround
drivers/tty/mxser.c | 7 ------- drivers/tty/serial/altera_jtaguart.c | 2 -- drivers/tty/serial/altera_uart.c | 2 -- drivers/tty/serial/amba-pl010.c | 2 -- drivers/tty/serial/amba-pl011.c | 2 -- drivers/tty/serial/apbuart.c | 2 -- drivers/tty/serial/ar933x_uart.c | 2 -- drivers/tty/serial/arc_uart.c | 2 -- drivers/tty/serial/atmel_serial.c | 18 ------------------ drivers/tty/serial/bcm63xx_uart.c | 2 -- drivers/tty/serial/icom.c | 2 -- drivers/tty/serial/lpc32xx_hs.c | 2 -- drivers/tty/serial/mcf.c | 2 -- drivers/tty/serial/meson_uart.c | 2 -- drivers/tty/serial/mpc52xx_uart.c | 2 -- drivers/tty/serial/msm_serial.c | 4 ---- drivers/tty/serial/owl-uart.c | 2 -- drivers/tty/serial/rda-uart.c | 2 -- drivers/tty/serial/rp2.c | 2 -- drivers/tty/serial/sa1100.c | 2 -- drivers/tty/serial/serial_txx9.c | 4 ++-- drivers/tty/serial/sifive.c | 2 -- drivers/tty/serial/sunsu.c | 4 ---- drivers/tty/serial/timbuart.c | 2 -- drivers/tty/serial/vt8500_serial.c | 2 -- drivers/tty/serial/xilinx_uartps.c | 3 +-- 26 files changed, 3 insertions(+), 77 deletions(-)
Signature · 1 line
2.26.3
PATCH 1/26 tty: mxser: drop low-latency workaround
Commit 67d2bc58afdd ("Char: mxser_new, fix recursive locking") worked around the infamous low_latency behaviour of tty_flip_buffer_push() by simply dropping and reacquiring the port lock in the interrupt handler.
Since commit a9c3f68f3cd8 ("tty: Fix low_latency BUG"), tty_flip_buffer_push() always schedules a work item to push data to the line discipline and there's no need to keep any low_latency hacks around.
--- drivers/tty/mxser.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/tty/mxser.c +0 -7
@@ -2155,14 +2155,7 @@ static void mxser_receive_chars(struct tty_struct *tty, port->mon_data.rxcnt += cnt; port->mon_data.up_rxcnt += cnt; -/* -* We are called from an interrupt context with &port->slock -* being held. Drop it temporarily in order to prevent -* recursive locking. -*/ -spin_unlock (&port->slock);tty_flip_buffer_push (&port->port); -spin_lock (&port->slock); }static void mxser_transmit_chars (struct tty_struct *tty,struct mxser_port *port)
Signature · 1 line
2.26.3
Re: [PATCH 01/26] tty: mxser: drop low-latency workaround
Quoted 10 lines · Johan Hovold
Commit
67d2bc58afdd("Char:mxser_new, fix recursive locking") worked around the infamouslow_latencybehaviour oftty_flip_buffer_push()by simply dropping and reacquiring the port lock in the interrupt handler.Since commit
a9c3f68f3cd8("tty: Fixlow_latencyBUG"),tty_flip_buffer_push()always schedules a work item to push data to the line discipline and there's no need to keep anylow_latencyhacks around.
Quoted 14 lines
--- drivers/tty/mxser.c | 7 ------- 1 file changed, 7 deletions(-)drivers/tty/mxser.c +0
-1@@ -2155,14 +2155,7 @@ static void mxser_receive_chars(struct tty_struct *tty, port->mon_data.rxcnt += cnt; port->mon_data.up_rxcnt += cnt; -/*
drivers/tty/mxser.c static void mxser_receive_chars(struct tty_struct *tty, · line 2161
Quoted 10 lines
drivers/tty/mxser.c +0
-6-* We are called from an interrupt context with &port->slock -* being held. Drop it temporarily in order to prevent -* recursive locking. -*/ -spin_unlock (&port->slock);tty_flip_buffer_push (&port->port); -spin_lock (&port->slock); }static void mxser_transmit_chars (struct tty_struct *tty,struct mxser_port *port)
thanks,
Signature · 1 line
js
PATCH 2/26 serial: altera_jtaguart: drop low-latency workaround
In reply to Johan HovoldCommit 53dd0ba7a6f4 ("tty: serial: altera_jtag: drop uart_port->lock before calling tty_flip_buffer_push()") claimed to address a locking issue but only provided a dubious lockdep splat from an unrelated driver, which in the end turned out to be due a broken local change carried by the author.
Unfortunately these patches were merged before the issue had been analysed properly so the commit messages makes no sense whatsoever.
The real issue was first seen on RT which at the time effectively always set the low_latency flag for all serial drivers by patching tty_flip_buffer_push(). This in turn revealed that many drivers did not handle the infamous low_latency behaviour which meant that data was pushed immediately to the line discipline instead of being deferred to a work queue.
Since commit a9c3f68f3cd8 ("tty: Fix low_latency BUG"), tty_flip_buffer_push() always schedules a work item to push data to the line discipline and there's no need to keep any low_latency hacks around.
--- drivers/tty/serial/altera_jtaguart.c | 2 -- 1 file changed, 2 deletions(-)
drivers/tty/serial/altera_jtaguart.c +0 -2
@@ -131,9 +131,7 @@ static void altera_jtaguart_rx_chars(struct altera_jtaguart *pp)uart_insert_char (port,0 ,0 , ch, flag); } -spin_unlock (&port->lock);tty_flip_buffer_push (&port->state->port); -spin_lock (&port->lock); }static void altera_jtaguart_tx_chars (struct altera_jtaguart *pp)
Signature · 1 line
2.26.3
Re: [PATCH 02/26] serial: altera_jtaguart: drop low-latency workaround
Quoted 16 lines · Johan Hovold
Commit
53dd0ba7a6f4("tty: serial:altera_jtag: dropuart_port->lockbefore callingtty_flip_buffer_push()") claimed to address a locking issue but only provided a dubious lockdep splat from an unrelated driver, which in the end turned out to be due a broken local change carried by the author.Unfortunately these patches were merged before the issue had been analysed properly so the commit messages makes no sense whatsoever.
The real issue was first seen on RT which at the time effectively always set the
low_latencyflag for all serial drivers by patchingtty_flip_buffer_push(). This in turn revealed that many drivers did not handle the infamouslow_latencybehaviour which meant that data was pushed immediately to the line discipline instead of being deferred to a work queue.
Quoted 8 lines
Since commit
a9c3f68f3cd8("tty: Fixlow_latencyBUG"),tty_flip_buffer_push()always schedules a work item to push data to the line discipline and there's no need to keep anylow_latencyhacks around.Cc Tobias Klauser <[email protected]>Signed-off-by Johan Hovold <[email protected]>
Thanks
PATCH 3/26 serial: altera_uart: drop low-latency workaround
In reply to Johan HovoldCommit dd085ed8ef6c ("tty: serial: altera: drop uart_port->lock before calling tty_flip_buffer_push()") claimed to address a locking issue but only provided a dubious lockdep splat from an unrelated driver, which in the end turned out to be due a broken local change carried by the author.
Unfortunately these patches were merged before the issue had been analysed properly so the commit messages makes no sense whatsoever.
The real issue was first seen on RT which at the time effectively always set the low_latency flag for all serial drivers by patching tty_flip_buffer_push(). This in turn revealed that many drivers did not handle the infamous low_latency behaviour which meant that data was pushed immediately to the line discipline instead of being deferred to a work queue.
Since commit a9c3f68f3cd8 ("tty: Fix low_latency BUG"), tty_flip_buffer_push() always schedules a work item to push data to the line discipline and there's no need to keep any low_latency hacks around.
--- drivers/tty/serial/altera_uart.c | 2 -- 1 file changed, 2 deletions(-)
drivers/tty/serial/altera_uart.c +0 -2
@@ -243,9 +243,7 @@ static void altera_uart_rx_chars(struct altera_uart *pp) flag); } -spin_unlock (&port->lock);tty_flip_buffer_push (&port->state->port); -spin_lock (&port->lock); }static void altera_uart_tx_chars (struct altera_uart *pp)
Signature · 1 line
2.26.3
Re: [PATCH 03/26] serial: altera_uart: drop low-latency workaround
Quoted 16 lines · Johan Hovold
Commit
dd085ed8ef6c("tty: serial: altera: dropuart_port->lockbefore callingtty_flip_buffer_push()") claimed to address a locking issue but only provided a dubious lockdep splat from an unrelated driver, which in the end turned out to be due a broken local change carried by the author.Unfortunately these patches were merged before the issue had been analysed properly so the commit messages makes no sense whatsoever.
The real issue was first seen on RT which at the time effectively always set the
low_latencyflag for all serial drivers by patchingtty_flip_buffer_push(). This in turn revealed that many drivers did not handle the infamouslow_latencybehaviour which meant that data was pushed immediately to the line discipline instead of being deferred to a work queue.
Quoted 8 lines
Since commit
a9c3f68f3cd8("tty: Fixlow_latencyBUG"),tty_flip_buffer_push()always schedules a work item to push data to the line discipline and there's no need to keep anylow_latencyhacks around.Cc Tobias Klauser <[email protected]>Signed-off-by Johan Hovold <[email protected]>
Thanks
PATCH 4/26 serial: amba-pl010: drop low-latency workaround
In reply to Johan HovoldCommit 2389b272168c ("[ARM] 4417/1: Serial: Fix AMBA drivers locking") worked around the infamous low_latency behaviour of tty_flip_buffer_push() by simply dropping and reacquiring the port lock in the interrupt handler.
Since commit a9c3f68f3cd8 ("tty: Fix low_latency BUG"), tty_flip_buffer_push() always schedules a work item to push data to the line discipline and there's no need to keep any low_latency hacks around.
--- drivers/tty/serial/amba-pl010.c | 2 -- 1 file changed, 2 deletions(-)
drivers/tty/serial/amba-pl010.c +0 -2
@@ -159,9 +159,7 @@ static void pl010_rx_chars(struct uart_amba_port *uap) ignore_char: status =readb (uap->port.membase + UART01x_FR); } -spin_unlock (&uap->port.lock);tty_flip_buffer_push (&uap->port.state->port); -spin_lock (&uap->port.lock); }static void pl010_tx_chars (struct uart_amba_port *uap)
Signature · 1 line
2.26.3
PATCH 5/26 serial: amba-pl011: drop low-latency workaround
In reply to Johan HovoldCommit ead76f329f77 ("ARM: 6763/1: pl011: add optional RX DMA to PL011 v2") added RX DMA support and also reproduced the workaround for the infamous low_latency behaviour of tty_flip_buffer_push() by dropping and reacquiring the port lock during receive processing.
Since commit a9c3f68f3cd8 ("tty: Fix low_latency BUG"), tty_flip_buffer_push() always schedules a work item to push data to the line discipline and there's no need to keep any low_latency hacks around.
Note that the port lock is also dropped in the PIO path (see pl011_rx_chars), but it is not clear whether this is still needed by the DMA code added by the aforementioned commit.
--- drivers/tty/serial/amba-pl011.c | 2 -- 1 file changed, 2 deletions(-)
drivers/tty/serial/amba-pl011.c +0 -2
@@ -937,12 +937,10 @@ static void pl011_dma_rx_chars(struct uart_amba_port *uap, fifotaken =pl011_fifo_to_tty (uap); } -spin_unlock (&uap->port.lock);dev_vdbg (uap->port.dev,"Took %d chars from DMA buffer and %d chars from the FIFO\n" , dma_count, fifotaken);tty_flip_buffer_push (port); -spin_lock (&uap->port.lock); }static void pl011_dma_rx_irq (struct uart_amba_port *uap)
Signature · 1 line
2.26.3
Re: [PATCH 05/26] serial: amba-pl011: drop low-latency workaround
Quoted 9 lines · Johan Hovold
Commit
ead76f329f77("ARM: 6763/1: pl011: add optional RX DMA to PL011 v2") added RX DMA support and also reproduced the workaround for the infamouslow_latencybehaviour oftty_flip_buffer_push()by dropping and reacquiring the port lock during receive processing.Since commit
a9c3f68f3cd8("tty: Fixlow_latencyBUG"),tty_flip_buffer_push()always schedules a work item to push data to the line discipline and there's no need to keep anylow_latencyhacks around.
Quoted 7 lines
Note that the port lock is also dropped in the PIO path (see
pl011_rx_chars), but it is not clear whether this is still needed by the DMA code added by the aforementioned commit.Cc Linus Walleij <[email protected]>Cc Russell King <[email protected]>Signed-off-by Johan Hovold <[email protected]>
Looks like the right thing to do to me! Thanks for digging this out.
Yours,
Linus Walleij
PATCH 6/26 serial: apbuart: drop low-latency workaround
In reply to Johan HovoldCommit 78d34d75c84d ("tty: serial: apbuart: drop uart_port->lock before calling tty_flip_buffer_push()") claimed to address a locking issue but only provided a dubious lockdep splat from an unrelated driver, which in the end turned out to be due a broken local change carried by the author.
Unfortunately these patches were merged before the issue had been analysed properly so the commit messages makes no sense whatsoever.
The real issue was first seen on RT which at the time effectively always set the low_latency flag for all serial drivers by patching tty_flip_buffer_push(). This in turn revealed that many drivers did not handle the infamous low_latency behaviour which meant that data was pushed immediately to the line discipline instead of being deferred to a work queue.
Since commit a9c3f68f3cd8 ("tty: Fix low_latency BUG"), tty_flip_buffer_push() always schedules a work item to push data to the line discipline and there's no need to keep any low_latency hacks around.
--- drivers/tty/serial/apbuart.c | 2 -- 1 file changed, 2 deletions(-)
drivers/tty/serial/apbuart.c +0 -2
@@ -117,9 +117,7 @@ static void apbuart_rx_chars(struct uart_port *port) status =UART_GET_STATUS (port); } -spin_unlock (&port->lock);tty_flip_buffer_push (&port->state->port); -spin_lock (&port->lock); }static void apbuart_tx_chars (struct uart_port *port)
Signature · 1 line
2.26.3
PATCH 7/26 serial: ar933x: drop low-latency workaround
In reply to Johan HovoldCommit b16c8e3eed12 ("tty: serial: ar933x: drop uart_port->lock before calling tty_flip_buffer_push()") claimed to address a locking issue but only provided a dubious lockdep splat from an unrelated driver, which in the end turned out to be due a broken local change carried by the author.
Unfortunately these patches were merged before the issue had been analysed properly so the commit messages makes no sense whatsoever.
The real issue was first seen on RT which at the time effectively always set the low_latency flag for all serial drivers by patching tty_flip_buffer_push(). This in turn revealed that many drivers did not handle the infamous low_latency behaviour which meant that data was pushed immediately to the line discipline instead of being deferred to a work queue.
Since commit a9c3f68f3cd8 ("tty: Fix low_latency BUG"), tty_flip_buffer_push() always schedules a work item to push data to the line discipline and there's no need to keep any low_latency hacks around.
--- drivers/tty/serial/ar933x_uart.c | 2 -- 1 file changed, 2 deletions(-)
drivers/tty/serial/ar933x_uart.c +0 -2
@@ -385,9 +385,7 @@ static void ar933x_uart_rx_chars(struct ar933x_uart_port *up)tty_insert_flip_char (port, ch,TTY_NORMAL ); }while (max_count-- >0 ); -spin_unlock (&up->port.lock);tty_flip_buffer_push (port); -spin_lock (&up->port.lock); }static void ar933x_uart_tx_chars (struct ar933x_uart_port *up)
Signature · 1 line
2.26.3
PATCH 8/26 serial: arc_uart: drop low-latency workaround
In reply to Johan HovoldCommit 3fa1200851c7 ("tty: serial: arc: drop uart_port->lock before calling tty_flip_buffer_push()") claimed to address a locking issue but only provided a dubious lockdep splat from an unrelated driver, which in the end turned out to be due a broken local change carried by the author.
Unfortunately these patches were merged before the issue had been analysed properly so the commit messages makes no sense whatsoever.
The real issue was first seen on RT which at the time effectively always set the low_latency flag for all serial drivers by patching tty_flip_buffer_push(). This in turn revealed that many drivers did not handle the infamous low_latency behaviour which meant that data was pushed immediately to the line discipline instead of being deferred to a work queue.
Since commit a9c3f68f3cd8 ("tty: Fix low_latency BUG"), tty_flip_buffer_push() always schedules a work item to push data to the line discipline and there's no need to keep any low_latency hacks around.
--- drivers/tty/serial/arc_uart.c | 2 -- 1 file changed, 2 deletions(-)
drivers/tty/serial/arc_uart.c +0 -2
@@ -236,9 +236,7 @@ static void arc_serial_rx_chars(struct uart_port *port, unsigned int status)if (!(uart_handle_sysrq_char (port, ch)))uart_insert_char (port, status,RXOERR , ch, flg); -spin_unlock (&port->lock);tty_flip_buffer_push (&port->state->port); -spin_lock (&port->lock); }while (!((status =UART_GET_STATUS (port)) &RXEMPTY )); }
Signature · 1 line
2.26.3
PATCH 9/26 serial: atmel_serial: drop low-latency workaround
In reply to Johan HovoldCommit 1ecc26bd2789 ("atmel_serial: split the interrupt handler") worked around the infamous low_latency behaviour of tty_flip_buffer_push() by dropping and reacquiring the port lock in the tasklet callback.
Since commit a9c3f68f3cd8 ("tty: Fix low_latency BUG"), tty_flip_buffer_push() always schedules a work item to push data to the line discipline and there's no need to keep any low_latency hacks around.
--- drivers/tty/serial/atmel_serial.c | 18 ------------------ 1 file changed, 18 deletions(-)
drivers/tty/serial/atmel_serial.c +0 -18
@@ -1178,13 +1178,7 @@ static void atmel_rx_from_dma(struct uart_port *port)1 , DMA_FROM_DEVICE); -/* -* Drop the lock here since it might end up calling -* uart_start(), which takes the lock. -*/ -spin_unlock (&port->lock);tty_flip_buffer_push (tport); -spin_lock (&port->lock);atmel_uart_writel (port,ATMEL_US_IER ,ATMEL_US_TIMEOUT ); }
@@ -1576,13 +1570,7 @@ static void atmel_rx_from_ring(struct uart_port *port)uart_insert_char (port, status,ATMEL_US_OVRE , c.ch, flg); } -/* -* Drop the lock here since it might end up calling -* uart_start(), which takes the lock. -*/ -spin_unlock (&port->lock);tty_flip_buffer_push (&port->state->port); -spin_lock (&port->lock); }static void atmel_release_rx_pdc (struct uart_port *port)
@@ -1667,13 +1655,7 @@ static void atmel_rx_from_pdc(struct uart_port *port) } }while (head >= pdc->dma_size); -/* -* Drop the lock here since it might end up calling -* uart_start(), which takes the lock. -*/ -spin_unlock (&port->lock);tty_flip_buffer_push (tport); -spin_lock (&port->lock);atmel_uart_writel (port,ATMEL_US_IER ,ATMEL_US_ENDRX |ATMEL_US_TIMEOUT );
Signature · 1 line
2.26.3
PATCH 10/26 serial: bcm63xx: drop low-latency workaround
In reply to Johan HovoldCommit b4d499241c34 ("tty: serial: bcm63xx: drop uart_port->lock before calling tty_flip_buffer_push()") claimed to address a locking issue but only provided a dubious lockdep splat from an unrelated driver, which in the end turned out to be due a broken local change carried by the author.
Unfortunately these patches were merged before the issue had been analysed properly so the commit messages makes no sense whatsoever.
The real issue was first seen on RT which at the time effectively always set the low_latency flag for all serial drivers by patching tty_flip_buffer_push(). This in turn revealed that many drivers did not handle the infamous low_latency behaviour which meant that data was pushed immediately to the line discipline instead of being deferred to a work queue.
Since commit a9c3f68f3cd8 ("tty: Fix low_latency BUG"), tty_flip_buffer_push() always schedules a work item to push data to the line discipline and there's no need to keep any low_latency hacks around.
--- drivers/tty/serial/bcm63xx_uart.c | 2 -- 1 file changed, 2 deletions(-)
drivers/tty/serial/bcm63xx_uart.c +0 -2
@@ -294,9 +294,7 @@ static void bcm_uart_do_rx(struct uart_port *port) }while (--max_count); -spin_unlock (&port->lock);tty_flip_buffer_push (tty_port); -spin_lock (&port->lock); }/*
Signature · 1 line
2.26.3
PATCH 11/26 serial: icom: drop low-latency workaround
In reply to Johan HovoldCommit 5faf75d7fed2 ("tty: serial: icom: drop uart_port->lock before calling tty_flip_buffer_push()") claimed to address a locking issue but only provided a dubious lockdep splat from an unrelated driver, which in the end turned out to be due a broken local change carried by the author.
Unfortunately these patches were merged before the issue had been analysed properly so the commit messages makes no sense whatsoever.
The real issue was first seen on RT which at the time effectively always set the low_latency flag for all serial drivers by patching tty_flip_buffer_push(). This in turn revealed that many drivers did not handle the infamous low_latency behaviour which meant that data was pushed immediately to the line discipline instead of being deferred to a work queue.
Since commit a9c3f68f3cd8 ("tty: Fix low_latency BUG"), tty_flip_buffer_push() always schedules a work item to push data to the line discipline and there's no need to keep any low_latency hacks around.
--- drivers/tty/serial/icom.c | 2 -- 1 file changed, 2 deletions(-)
drivers/tty/serial/icom.c +0 -2
@@ -829,9 +829,7 @@ static void recv_interrupt(u16 port_int_reg, struct icom_port *icom_port) } icom_port->next_rcv = rcv_buff; -spin_unlock (&icom_port->uart_port.lock);tty_flip_buffer_push (port); -spin_lock (&icom_port->uart_port.lock); } static void process_interrupt(u16 port_int_reg,
Signature · 1 line
2.26.3
PATCH 12/26 serial: lpc32xx_hs: drop low-latency workaround
In reply to Johan HovoldCommit ec128510905c ("tty: serial: lpc32xx_hs: drop uart_port->lock before calling tty_flip_buffer_push()") claimed to address a locking issue but only provided a dubious lockdep splat from an unrelated driver, which in the end turned out to be due a broken local change carried by the author.
Unfortunately these patches were merged before the issue had been analysed properly so the commit messages makes no sense whatsoever.
The real issue was first seen on RT which at the time effectively always set the low_latency flag for all serial drivers by patching tty_flip_buffer_push(). This in turn revealed that many drivers did not handle the infamous low_latency behaviour which meant that data was pushed immediately to the line discipline instead of being deferred to a work queue.
Since commit a9c3f68f3cd8 ("tty: Fix low_latency BUG"), tty_flip_buffer_push() always schedules a work item to push data to the line discipline and there's no need to keep any low_latency hacks around.
--- drivers/tty/serial/lpc32xx_hs.c | 2 -- 1 file changed, 2 deletions(-)
drivers/tty/serial/lpc32xx_hs.c +0 -2
@@ -273,9 +273,7 @@ static void __serial_lpc32xx_rx(struct uart_port *port) tmp =readl (LPC32XX_HSUART_FIFO (port->membase)); } -spin_unlock (&port->lock);tty_flip_buffer_push (tport); -spin_lock (&port->lock); }static void __serial_lpc32xx_tx (struct uart_port *port)
Signature · 1 line
2.26.3
PATCH 13/26 serial: mcf: drop low-latency workaround
In reply to Johan HovoldCommit 5275ad70fed3 ("tty: serial: mcf: drop uart_port->lock before calling tty_flip_buffer_push()") claimed to address a locking issue but only provided a dubious lockdep splat from an unrelated driver, which in the end turned out to be due a broken local change carried by the author.
Unfortunately these patches were merged before the issue had been analysed properly so the commit messages makes no sense whatsoever.
The real issue was first seen on RT which at the time effectively always set the low_latency flag for all serial drivers by patching tty_flip_buffer_push(). This in turn revealed that many drivers did not handle the infamous low_latency behaviour which meant that data was pushed immediately to the line discipline instead of being deferred to a work queue.
Since commit a9c3f68f3cd8 ("tty: Fix low_latency BUG"), tty_flip_buffer_push() always schedules a work item to push data to the line discipline and there's no need to keep any low_latency hacks around.
--- drivers/tty/serial/mcf.c | 2 -- 1 file changed, 2 deletions(-)
drivers/tty/serial/mcf.c +0 -2
@@ -319,9 +319,7 @@ static void mcf_rx_chars(struct mcf_uart *pp)uart_insert_char (port, status,MCFUART_USR_RXOVERRUN , ch, flag); } -spin_unlock (&port->lock);tty_flip_buffer_push (&port->state->port); -spin_lock (&port->lock); }/****************************************************************************/
Signature · 1 line
2.26.3
PATCH 14/26 serial: meson: drop low-latency workaround
In reply to Johan HovoldThe meson driver has always carried an unnecessary workaround for the infamous low_latency behaviour of tty_flip_buffer_push(), which had already been removed by the time the driver was added by commit ff7693d079e5 ("ARM: meson: serial: add MesonX SoC on-chip uart driver").
Specifically, since commit a9c3f68f3cd8 ("tty: Fix low_latency BUG"), tty_flip_buffer_push() always schedules a work item to push data to the line discipline and there's no need to keep any low_latency hacks around.
--- drivers/tty/serial/meson_uart.c | 2 -- 1 file changed, 2 deletions(-)
drivers/tty/serial/meson_uart.c +0 -2
@@ -226,9 +226,7 @@ static void meson_receive_chars(struct uart_port *port) }while (!(readl (port->membase +AML_UART_STATUS ) &AML_UART_RX_EMPTY )); -spin_unlock (&port->lock);tty_flip_buffer_push (tport); -spin_lock (&port->lock); }static irqreturn_t meson_uart_interrupt (int irq,void *dev_id)
Signature · 1 line
2.26.3
PATCH 15/26 serial: mpc52xx_uart: drop low-latency workaround
In reply to Johan HovoldCommit fbe543b412ce ("Fix a potential issue in mpc52xx uart driver") worked around the infamous low_latency behaviour of tty_flip_buffer_push() by simply dropping and reacquiring the port lock in the interrupt handler.
Since commit a9c3f68f3cd8 ("tty: Fix low_latency BUG"), tty_flip_buffer_push() always schedules a work item to push data to the line discipline and there's no need to keep any low_latency hacks around.
--- drivers/tty/serial/mpc52xx_uart.c | 2 -- 1 file changed, 2 deletions(-)
drivers/tty/serial/mpc52xx_uart.c +0 -2
@@ -1421,9 +1421,7 @@ mpc52xx_uart_int_rx_chars(struct uart_port *port) } } -spin_unlock (&port->lock);tty_flip_buffer_push (tport); -spin_lock (&port->lock);return psc_ops->raw_rx_rdy (port); }
Signature · 1 line
2.26.3
PATCH 16/26 serial: msm_serial: drop low-latency workaround
In reply to Johan HovoldCommit f77232dab25b ("tty: serial: msm: drop uart_port->lock before calling tty_flip_buffer_push()") claimed to address a locking issue but only provided a dubious lockdep splat from an unrelated driver, which in the end turned out to be due a broken local change carried by the author.
Unfortunately these patches were merged before the issue had been analysed properly so the commit messages makes no sense whatsoever.
The real issue was first seen on RT which at the time effectively always set the low_latency flag for all serial drivers by patching tty_flip_buffer_push(). This in turn revealed that many drivers did not handle the infamous low_latency behaviour which meant that data was pushed immediately to the line discipline instead of being deferred to a work queue.
Since commit a9c3f68f3cd8 ("tty: Fix low_latency BUG"), tty_flip_buffer_push() always schedules a work item to push data to the line discipline and there's no need to keep any low_latency hacks around.
--- drivers/tty/serial/msm_serial.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/tty/serial/msm_serial.c +0 -4
@@ -757,9 +757,7 @@ static void msm_handle_rx_dm(struct uart_port *port, unsigned int misr) count -= r_count; } -spin_unlock (&port->lock);tty_flip_buffer_push (tport); -spin_lock (&port->lock);if (misr & (UART_IMR_RXSTALE ))msm_write (port,UART_CR_CMD_RESET_STALE_INT ,UART_CR );
@@ -819,9 +817,7 @@ static void msm_handle_rx(struct uart_port *port)tty_insert_flip_char (tport, c, flag); } -spin_unlock (&port->lock);tty_flip_buffer_push (tport); -spin_lock (&port->lock); }static void msm_handle_tx_pio (struct uart_port *port,unsigned int tx_count)
Signature · 1 line
2.26.3
Re: [PATCH 16/26] serial: msm_serial: drop low-latency workaround
Quoted 16 lines · Johan Hovold
Commit
f77232dab25b("tty: serial: msm: dropuart_port->lockbefore callingtty_flip_buffer_push()") claimed to address a locking issue but only provided a dubious lockdep splat from an unrelated driver, which in the end turned out to be due a broken local change carried by the author.Unfortunately these patches were merged before the issue had been analysed properly so the commit messages makes no sense whatsoever.
The real issue was first seen on RT which at the time effectively always set the
low_latencyflag for all serial drivers by patchingtty_flip_buffer_push(). This in turn revealed that many drivers did not handle the infamouslow_latencybehaviour which meant that data was pushed immediately to the line discipline instead of being deferred to a work queue.
Quoted 8 lines
Since commit
a9c3f68f3cd8("tty: Fixlow_latencyBUG"),tty_flip_buffer_push()always schedules a work item to push data to the line discipline and there's no need to keep anylow_latencyhacks around.Cc Andy Gross <[email protected]>Cc Bjorn Andersson <[email protected]>
Regards,
Bjorn
Quoted 32 lines
Signed-off-by Johan Hovold <[email protected]>--- drivers/tty/serial/msm_serial.c | 4 ---- 1 file changed, 4 deletions(-)drivers/tty/serial/msm_serial.c +0
-4@@ -757,9 +757,7 @@ static void msm_handle_rx_dm(struct uart_port *port, unsigned int misr) count -= r_count; } -spin_unlock (&port->lock);tty_flip_buffer_push (tport); -spin_lock (&port->lock);if (misr & (UART_IMR_RXSTALE ))msm_write (port,UART_CR_CMD_RESET_STALE_INT ,UART_CR );@@ -819,9 +817,7 @@ static void msm_handle_rx(struct uart_port *port)tty_insert_flip_char (tport, c, flag); } -spin_unlock (&port->lock);tty_flip_buffer_push (tport); -spin_lock (&port->lock); }static void msm_handle_tx_pio (struct uart_port *port,unsigned int tx_count)Signature · 1 line
2.26.3
PATCH 17/26 serial: owl: drop low-latency workaround
In reply to Johan HovoldThe owl driver has always carried an unnecessary workaround for the infamous low_latency behaviour of tty_flip_buffer_push(), which had been removed years before the driver was added by commit fc60a8b675bd ("tty: serial: owl: Implement console driver").
Specifically, since commit a9c3f68f3cd8 ("tty: Fix low_latency BUG"), tty_flip_buffer_push() always schedules a work item to push data to the line discipline and there's no need to keep any low_latency hacks around.
--- drivers/tty/serial/owl-uart.c | 2 -- 1 file changed, 2 deletions(-)
drivers/tty/serial/owl-uart.c +0 -2
@@ -247,9 +247,7 @@ static void owl_uart_receive_chars(struct uart_port *port) stat =owl_uart_read (port,OWL_UART_STAT ); } -spin_unlock (&port->lock);tty_flip_buffer_push (&port->state->port); -spin_lock (&port->lock); }static irqreturn_t owl_uart_irq (int irq,void *dev_id)
Signature · 1 line
2.26.3
PATCH 18/26 serial: rda: drop low-latency workaround
In reply to Johan HovoldThe rda driver has always carried an unnecessary workaround for the infamous low_latency behaviour of tty_flip_buffer_push(), which had been removed years before the driver was added by commit c10b13325ced ("tty: serial: Add RDA8810PL UART driver").
Specifically, since commit a9c3f68f3cd8 ("tty: Fix low_latency BUG"), tty_flip_buffer_push() always schedules a work item to push data to the line discipline and there's no need to keep any low_latency hacks around.
--- drivers/tty/serial/rda-uart.c | 2 -- 1 file changed, 2 deletions(-)
drivers/tty/serial/rda-uart.c +0 -2
@@ -398,9 +398,7 @@ static void rda_uart_receive_chars(struct uart_port *port) status =rda_uart_read (port,RDA_UART_STATUS ); } -spin_unlock (&port->lock);tty_flip_buffer_push (&port->state->port); -spin_lock (&port->lock); }static irqreturn_t rda_interrupt (int irq,void *dev_id)
Signature · 1 line
2.26.3
PATCH 19/26 serial: rp2: drop low-latency workaround
In reply to Johan HovoldCommit de7053c77123 ("tty: serial: rp2: drop uart_port->lock before calling tty_flip_buffer_push()") claimed to address a locking issue but only provided a dubious lockdep splat from an unrelated driver, which in the end turned out to be due a broken local change carried by the author.
Unfortunately these patches were merged before the issue had been analysed properly so the commit messages makes no sense whatsoever.
The real issue was first seen on RT which at the time effectively always set the low_latency flag for all serial drivers by patching tty_flip_buffer_push(). This in turn revealed that many drivers did not handle the infamous low_latency behaviour which meant that data was pushed immediately to the line discipline instead of being deferred to a work queue.
Since commit a9c3f68f3cd8 ("tty: Fix low_latency BUG"), tty_flip_buffer_push() always schedules a work item to push data to the line discipline and there's no need to keep any low_latency hacks around.
--- drivers/tty/serial/rp2.c | 2 -- 1 file changed, 2 deletions(-)
drivers/tty/serial/rp2.c +0 -2
@@ -424,9 +424,7 @@ static void rp2_rx_chars(struct rp2_uart_port *up) up->port.icount.rx++; } -spin_unlock (&up->port.lock);tty_flip_buffer_push (port); -spin_lock (&up->port.lock); }static void rp2_tx_chars (struct rp2_uart_port *up)
Signature · 1 line
2.26.3
PATCH 20/26 serial: sa1100: drop low-latency workaround
In reply to Johan HovoldCommit 53e0e6706c76 ("tty: serial: sa1100: drop uart_port->lock before calling tty_flip_buffer_push()") claimed to address a locking issue but only provided a dubious lockdep splat from an unrelated driver, which in the end turned out to be due a broken local change carried by the author.
Unfortunately these patches were merged before the issue had been analysed properly so the commit messages makes no sense whatsoever.
The real issue was first seen on RT which at the time effectively always set the low_latency flag for all serial drivers by patching tty_flip_buffer_push(). This in turn revealed that many drivers did not handle the infamous low_latency behaviour which meant that data was pushed immediately to the line discipline instead of being deferred to a work queue.
Since commit a9c3f68f3cd8 ("tty: Fix low_latency BUG"), tty_flip_buffer_push() always schedules a work item to push data to the line discipline and there's no need to keep any low_latency hacks around.
--- drivers/tty/serial/sa1100.c | 2 -- 1 file changed, 2 deletions(-)
drivers/tty/serial/sa1100.c +0 -2
@@ -223,9 +223,7 @@ sa1100_rx_chars(struct sa1100_port *sport)UTSR0_TO_SM (UART_GET_UTSR0 (sport)); } -spin_unlock (&sport->port.lock);tty_flip_buffer_push (&sport->port.state->port); -spin_lock (&sport->port.lock); }static void sa1100_tx_chars (struct sa1100_port *sport)
Signature · 1 line
2.26.3
PATCH 21/26 serial: txx9: drop low-latency workaround
In reply to Johan HovoldCommit f5ee56cc184e ("[PATCH] txx9 serial update") worked around the infamous low_latency behaviour of tty_flip_buffer_push() by simply dropping and reacquiring the port lock in the interrupt handler.
Since commit a9c3f68f3cd8 ("tty: Fix low_latency BUG"), tty_flip_buffer_push() always schedules a work item to push data to the line discipline and there's no need to keep any low_latency hacks around.
--- drivers/tty/serial/serial_txx9.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/serial/serial_txx9.c +2 -2
@@ -330,9 +330,9 @@ receive_chars(struct uart_txx9_port *up, unsigned int *status) up->port.ignore_status_mask = next_ignore_status_mask; disr =sio_in (up,TXX9_SIDISR ); }while (!(disr &TXX9_SIDISR_UVALID ) && (max_count-- >0 )); -spin_unlock (&up->port.lock); +tty_flip_buffer_push (&up->port.state->port); -spin_lock (&up->port.lock); + *status = disr; }
Signature · 1 line
2.26.3
PATCH 22/26 serial: sifive: drop low-latency workaround
In reply to Johan HovoldThe sifive driver has always carried an unnecessary workaround for the infamous low_latency behaviour of tty_flip_buffer_push() which had been removed years before the driver was added by commit 45c054d0815b ("tty:
serial: add driver for the SiFive UART").
Specifically, since commit a9c3f68f3cd8 ("tty: Fix low_latency BUG"), tty_flip_buffer_push() always schedules a work item to push data to the line discipline and there's no need to keep any low_latency hacks around.
--- drivers/tty/serial/sifive.c | 2 -- 1 file changed, 2 deletions(-)
drivers/tty/serial/sifive.c +0 -2
@@ -448,9 +448,7 @@ static void __ssp_receive_chars(struct sifive_serial_port *ssp)uart_insert_char (&ssp->port,0 ,0 , ch,TTY_NORMAL ); } -spin_unlock (&ssp->port.lock);tty_flip_buffer_push (&ssp->port.state->port); -spin_lock (&ssp->port.lock); }/**
Signature · 1 line
2.26.3
PATCH 23/26 serial: sunsu: drop low-latency workaround
In reply to Johan HovoldThe sunsu driver has been carrying a workaround for the infamous low_latency behaviour of tty_flip_buffer_push() by dropping and reacquiring the port lock in the interrupt handler since 2004.
Since commit a9c3f68f3cd8 ("tty: Fix low_latency BUG"), tty_flip_buffer_push() always schedules a work item to push data to the line discipline and there's no need to keep any low_latency hacks around.
--- drivers/tty/serial/sunsu.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/tty/serial/sunsu.c +0 -4
@@ -466,12 +466,8 @@ static irqreturn_t sunsu_serial_interrupt(int irq, void *dev_id)if (status &UART_LSR_THRE )transmit_chars (up); -spin_unlock_irqrestore (&up->port.lock, flags); -tty_flip_buffer_push (&up->port.state->port); -spin_lock_irqsave (&up->port.lock, flags); - }while (!(serial_in (up,UART_IIR ) &UART_IIR_NO_INT ));spin_unlock_irqrestore (&up->port.lock, flags);
Signature · 1 line
2.26.3
Re: [PATCH 23/26] serial: sunsu: drop low-latency workaround
From: Johan Hovold <[email protected]>
Date: Wed, 21 Apr 2021 11:55:06 +0200
Quoted 10 lines
The sunsu driver has been carrying a workaround for the infamous
low_latencybehaviour oftty_flip_buffer_push()by dropping and reacquiring the port lock in the interrupt handler since 2004.Since commit
a9c3f68f3cd8("tty: Fixlow_latencyBUG"),tty_flip_buffer_push()always schedules a work item to push data to the line discipline and there's no need to keep anylow_latencyhacks around.Cc "David S. Miller" <[email protected]>Signed-off-by Johan Hovold <[email protected]>
PATCH 24/26 serial: timbuart: drop low-latency workaround
In reply to Johan HovoldThe timbuart driver has always carried a workaround for the infamous low_latency behaviour of tty_flip_buffer_push() which required not holding the port lock when the low_latency flag was set.
Since commit a9c3f68f3cd8 ("tty: Fix low_latency BUG"), tty_flip_buffer_push() always schedules a work item to push data to the line discipline and there's no need to keep any low_latency hacks around.
--- drivers/tty/serial/timbuart.c | 2 -- 1 file changed, 2 deletions(-)
drivers/tty/serial/timbuart.c +0 -2
@@ -87,9 +87,7 @@ static void timbuart_rx_chars(struct uart_port *port)tty_insert_flip_char (tport, ch,TTY_NORMAL ); } -spin_unlock (&port->lock);tty_flip_buffer_push (tport); -spin_lock (&port->lock);dev_dbg (port->dev,"%s - total read %d bytes\n" , __func__, port->icount.rx);
Signature · 1 line
2.26.3
PATCH 25/26 serial: vt8500: drop low-latency workaround
In reply to Johan HovoldCommit de49df58366f ("tty: serial: vt8500: drop uart_port->lock before calling tty_flip_buffer_push()") claimed to address a locking issue but only provided a dubious lockdep splat from an unrelated driver, which in the end turned out to be due a broken local change carried by the author.
Unfortunately these patches were merged before the issue had been analysed properly so the commit messages makes no sense whatsoever.
The real issue was first seen on RT which at the time effectively always set the low_latency flag for all serial drivers by patching tty_flip_buffer_push(). This in turn revealed that many drivers did not handle the infamous low_latency behaviour which meant that data was pushed immediately to the line discipline instead of being deferred to a work queue.
Since commit a9c3f68f3cd8 ("tty: Fix low_latency BUG"), tty_flip_buffer_push() always schedules a work item to push data to the line discipline and there's no need to keep any low_latency hacks around.
--- drivers/tty/serial/vt8500_serial.c | 2 -- 1 file changed, 2 deletions(-)
drivers/tty/serial/vt8500_serial.c +0 -2
@@ -184,9 +184,7 @@ static void handle_rx(struct uart_port *port)tty_insert_flip_char (tport, c, flag); } -spin_unlock (&port->lock);tty_flip_buffer_push (tport); -spin_lock (&port->lock); }static void handle_tx (struct uart_port *port)
Signature · 1 line
2.26.3
PATCH 26/26 serial: xilinx_uartps: drop low-latency workaround
In reply to Johan HovoldCommit c8dbdc842d30 ("serial: xuartps: Rewrite the interrupt handling logic") reworked the driver interrupt processing but also, without comment, added an unnecessary workaround for the infamous low_latency behaviour of tty_flip_buffer_push() which had been removed years before.
Specifically, since commit a9c3f68f3cd8 ("tty: Fix low_latency BUG"), tty_flip_buffer_push() always schedules a work item to push data to the line discipline and there's no need to keep any low_latency hacks around.
--- drivers/tty/serial/xilinx_uartps.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/tty/serial/xilinx_uartps.c +1 -2
@@ -301,9 +301,8 @@ static void cdns_uart_handle_rx(void *dev_id, unsigned int isrstatus)tty_insert_flip_char (&port->state->port, data, status); isrstatus =0 ; } -spin_unlock (&port->lock); +tty_flip_buffer_push (&port->state->port); -spin_lock (&port->lock); }/**
Signature · 1 line
2.26.3
Greg Kroah-Hartman
maintainerQuoted 14 lines · Johan Hovold
The infamous
low_latencybehaviour oftty_flip_buffer_push(), which meant that data could be pushed to the line discipline immediately instead of being deferred to a work queue, was finally removed in 2014.Since then there's no need for drivers to keep hacks to temporarily drop the port lock during receive processing but this pattern has been reproduced in later added drivers nonetheless.
Note that several of these workarounds were added by a series posted in 2013, which ended up being merged despite having completely nonsensical commit messages. As it turned out, it was just the RT patch set which effectively enabled the
low_latencyflag for serial drivers that did not handle it.
Quoted 4 lines
There's of course nothing wrong releasing the port lock before calling
tty_flip_buffer_push(), and some drivers still do after this series, but let's get rid of the completely unnecessary unlock-and-reacquire pattern.
Many thanks for cleaning up this old crud, all now applied.
greg k-h