serial: sh-sci: rx overrun errors and hrtimer rx_timeout?
Hi,
short: What is the sh-sci rx DMA hrtimer configured to rx_timeout good for?
Long story:
Using drivers/tty/serial/sh-sci.c (on 4.14.x Renesas BSP) what is quite similar to [1] we got reports about data loss on rx large files (test case rx 1GB file):
$ cat /proc/tty/driver/sci serinfo:1.0 driver revision: 0: uart:scif mmio:0xE6E88000 irq:88 tx:40991 rx:16 RTS|CTS|DTR|DSR|CD 1: uart:hscif mmio:0xE66B0000 irq:45 tx:908 rx:1410 RTS|CTS|DTR|DSR|CD 2: uart:scif mmio:0xE6C40000 irq:89 tx:0 rx:0 CTS|DSR|CD 3: uart:scif mmio:0xE6E68000 irq:87 tx:0 rx:0 CTS|DSR|CD 4: uart:scif mmio:0xE6E60000 irq:86 tx:3506 rx:179863 oe:141 RTS|CTS|DTR|DSR|CD
See the oe (overrun error?) at uart #4.
For testing the hrtimer rx_timeout was changed (for example to 1000 by adding a sysfs interface for it) and with that the oe are reduced (again, uart #4):
$ echo 1000 > /sys/class/tty/ttySC4/device/rx_timeout $ cat /proc/tty/driver/sci serinfo:1.0 driver revision: 0: uart:scif mmio:0xE6E88000 irq:88 tx:41621 rx:3 RTS|CTS|DTR|DSR|CD 1: uart:hscif mmio:0xE66B0000 irq:45 tx:908 rx:1395 RTS|CTS|DTR|DSR|CD 2: uart:scif mmio:0xE6C40000 irq:89 tx:0 rx:0 CTS|DSR|CD 3: uart:scif mmio:0xE6E68000 irq:87 tx:0 rx:0 CTS|DSR|CD 4: uart:scif mmio:0xE6E60000 irq:86 tx:514 rx:688401 oe:3 RTS|CTS|DTR|DSR|CD
I'm slightly unclear, but general high system load might be involved in these tests.
Now, looking at the code, I'm slightly unclear what this hrtimer and its timeout is used for in relation to the rx DMA? It seems it controls if the DMA is finished after the rx_timeout and if not it setup a new DMA? How might changing the timeout influence the overrun errors?
Best regards
Dirk
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/tty/serial/sh-sci.c
Hi Dirk,
Quoted 7 lines · Dirk Behme
short: What is the sh-sci rx DMA hrtimer configured to
rx_timeoutgood for?Long story:
Using
drivers/tty/serial/sh-sci.c(on 4.14.x Renesas BSP) what is quite similar to [1] we got reports about data loss on rx large files (test case rx 1GB file):
[...]
I'll answer the short question ;-)
When RX DMA is enabled, data is received in the RX FIFO. Only when the FIFO is full, an interrupt is raised, and the data is received by Linux, and passed to the next layer.
So what happens if less data is received than the FIFO size? In that case, the data would be stuck in the FIFO, as no interrupt is raised. Hence a hrtimer is used to make sure Linux receives data from a partially-filled FIFO when no more data arrives soon (within rx_timeout µs).
I hope this helps to understand the problem you are seeing.
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds