linux/drivers/tty/serial
Jan Kundrát 2258761213 serial: max310x: Reduce RX work starvation
Prior to this patch, the code would happily trigger TX on some ports
before having a chance of reading the RX buffer from the rest of them.
When no flow control was used, this led to RX buffer overruns and
therefore lost data under certain circumstances.

I was able to reproduce this with MAX14830 (that's a quad channel one)
and a simple daisy-chain of RX and TX ports on the eval board:

- TX0 -> RX1
- TX1 -> RX2
- TX2 -> RX3
- TX3 -> RX0

I was testing this by transferring 2MB of data at 115200 baud via each
port. I used a Solidrun Clearfog Base (Armada 388) which was talking to
the UART over an SPI bus clocked at 26MHz (the chip's maximum). Without
this patch, I would always get a "Possible RX FIFO overrun" in dmesg,
and fewer-than-expected amount of bytes received over ttyMAX0. Results
on ttyMAX{1,2,3} tended to be correct all the time, even without the
previous patches in this series and with PIO SPI transfers ("indirect
mode" as the Marvell datasheet calls it), so I assume that heavy
congestion is needed in order to reproduce this.

A drawback of this patch is that the throughput gets reduced "a bit".
Previously, a 115200 baud resulted in about 11.2kBps throughput as
reported by a simple `pv`. With this patch, the throughput of four
parallel streams is roughly 7kBps each, and 9kBps for three streams.
There is no slowdown for one or two parallel streams.

Situation is worse if bytes are being read one-by-one (such as if the
userspace wants to perform parity/framing/break checking) and therefore
without the batched reads.

With just this patch and no other modifications on top of 4.14, I was
only getting roughly 3.6kBps with four parallel streams. The
single-stream performance was the same, and I was seeing about 7.2kBps
with two parallel streams. `perf top` said that a substantial amount of
time was spent in `finish_task_switch`, `_raw_spin_unlock_irqrestore`
and `__timer_delay`.

Signed-off-by: Jan Kundrát <jan.kundrat@cesnet.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-19 09:59:02 +01:00
..
8250 serial: 8250: 8250_omap: Fix spelling error. 2017-12-15 20:27:44 +01:00
cpm_uart TTY/Serial patches for 4.15-rc1 2017-11-13 21:05:31 -08:00
jsm tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
21285.c tty: add SPDX identifiers to all remaining files in drivers/tty/ 2017-11-08 13:08:12 +01:00
altera_jtaguart.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
altera_uart.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
amba-pl010.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
amba-pl011.c serial: pl011: Use cached copy of IMSC register 2017-11-28 15:35:51 +01:00
amba-pl011.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
apbuart.c tty: add SPDX identifiers to all remaining files in drivers/tty/ 2017-11-08 13:08:12 +01:00
apbuart.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ar933x_uart.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
arc_uart.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
atmel_serial.c serial: Make retrieval of rs485 properties platform-agnostic 2017-11-28 16:04:57 +01:00
atmel_serial.h tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
bcm63xx_uart.c MIPS changes for 4.15 2017-11-15 11:36:08 -08:00
bfin_sport_uart.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
bfin_sport_uart.h tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
bfin_uart.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
clps711x.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
crisv10.c treewide: setup_timer() -> timer_setup() 2017-11-21 15:57:07 -08:00
crisv10.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
digicolor-usart.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
dz.c tty: add SPDX identifiers to all remaining files in drivers/tty/ 2017-11-08 13:08:12 +01:00
dz.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
earlycon-arm-semihost.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
earlycon.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
efm32-uart.c tty: add SPDX identifiers to all remaining files in drivers/tty/ 2017-11-08 13:08:12 +01:00
etraxfs-uart.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
fsl_lpuart.c serial: fsl_lpuart: Support common rs485 binding for RTS polarity 2017-11-28 16:05:20 +01:00
icom.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
icom.h tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
ifx6x60.c treewide: setup_timer() -> timer_setup() 2017-11-21 15:57:07 -08:00
ifx6x60.h tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
imx.c serial: imx: Support common rs485 binding for RTS polarity 2017-11-28 16:05:20 +01:00
ioc3_serial.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
ioc4_serial.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
ip22zilog.c tty: add SPDX identifiers to all remaining files in drivers/tty/ 2017-11-08 13:08:12 +01:00
ip22zilog.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Kconfig tty: serial: sh-sci: Add default for number of ports for compile-testing 2017-12-18 10:28:31 +01:00
kgdb_nmi.c treewide: setup_timer() -> timer_setup() 2017-11-21 15:57:07 -08:00
kgdboc.c Modules updates for v4.15 2017-11-15 13:46:33 -08:00
lantiq.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
lpc32xx_hs.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
m32r_sio_reg.h tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
m32r_sio.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
max310x.c serial: max310x: Reduce RX work starvation 2017-12-19 09:59:02 +01:00
max3100.c treewide: setup_timer() -> timer_setup() 2017-11-21 15:57:07 -08:00
mcf.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
men_z135_uart.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
meson_uart.c tty: serial: meson: fix typo in the "stop bit" register definition 2017-11-28 15:32:33 +01:00
mpc52xx_uart.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
mps2-uart.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
mpsc.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
msm_serial.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
mux.c treewide: setup_timer() -> timer_setup() 2017-11-21 15:57:07 -08:00
mvebu-uart.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
mxs-auart.c tty: serial: mxs-auart: fix error handling in mxs_auart_probe 2017-12-15 20:27:44 +01:00
netx-serial.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
omap-serial.c serial: core: Support common rs485 binding for RTS polarity 2017-11-28 16:05:19 +01:00
owl-uart.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
pch_uart.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
pic32_uart.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
pic32_uart.h tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
pmac_zilog.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
pmac_zilog.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pnx8xxx_uart.c treewide: setup_timer() -> timer_setup() 2017-11-21 15:57:07 -08:00
pxa.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
rp2.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
sa1100.c treewide: setup_timer() -> timer_setup() 2017-11-21 15:57:07 -08:00
samsung.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
samsung.h tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
sb1250-duart.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
sc16is7xx.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
sccnxp.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
serial_core.c serial: core: Support common rs485 binding for RTS polarity 2017-11-28 16:05:19 +01:00
serial_ks8695.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
serial_mctrl_gpio.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
serial_mctrl_gpio.h tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
serial_txx9.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
serial-tegra.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
sh-sci.c treewide: setup_timer() -> timer_setup() 2017-11-21 15:57:07 -08:00
sh-sci.h TTY/Serial patches for 4.15-rc1 2017-11-13 21:05:31 -08:00
sirfsoc_uart.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
sirfsoc_uart.h tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
sn_console.c treewide: setup_timer() -> timer_setup() 2017-11-21 15:57:07 -08:00
sprd_serial.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
st-asc.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
stm32-usart.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
stm32-usart.h serial: stm32: fix name conflict with 8250 2017-12-15 20:27:43 +01:00
suncore.c tty: add SPDX identifiers to all remaining files in drivers/tty/ 2017-11-08 13:08:12 +01:00
sunhv.c tty: add SPDX identifiers to all remaining files in drivers/tty/ 2017-11-08 13:08:12 +01:00
sunsab.c tty: add SPDX identifiers to all remaining files in drivers/tty/ 2017-11-08 13:08:12 +01:00
sunsab.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sunsu.c tty: add SPDX identifiers to all remaining files in drivers/tty/ 2017-11-08 13:08:12 +01:00
sunzilog.c tty: add SPDX identifiers to all remaining files in drivers/tty/ 2017-11-08 13:08:12 +01:00
sunzilog.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
tilegx.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
timbuart.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
timbuart.h tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
uartlite.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
ucc_uart.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
vr41xx_siu.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
vt8500_serial.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
xilinx_uartps.c tty: serial: Remove redundant license text 2017-11-08 13:08:12 +01:00
zs.c tty: add SPDX identifiers to all remaining files in drivers/tty/ 2017-11-08 13:08:12 +01:00
zs.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00