Is there a way to improve latency on serial port data processing in Linux (4.8)? In particular, the time between actual data on the line and when select()
and read read()
functions on this port return.
Right now, my measurement shows 350 microseconds. The process is run with SCHED_RR
priority 90. Is there a way to shorten this time or I have to change the driver? I'm using a 16C550 compatible chip from PERICOM (PI7C9X7954).
epoll()
outperformsselect()
, you can try it. Anyway, it's hard to tell anything particular without knowing the whole picture. It would be great if you can profile further all related time points: interrupt in driver (data received), point whereselect()
releases in kernel, and point whereselect()
releases in user-space. Btw, check if your device issues an interrupt, otherwise it's polling in kernel, which can cause delays. – Sam Protsenkoselect()
- didn't make much difference in latency. – ilya1725read()
syscall). It's hard to predict its time without actual measurement. So you need to profile your TTY driver along with user space code, and see where is actual bottleneck happens. Only then you can decide how to solve that problem. Maybe driver needs to be fixed, or maybe your hardware is polling by driver (instead of interrupt), or maybe you need to write your time-critical code in kernel space instead. – Sam Protsenkodmesg
oruname -a
) will have the word "PREEMPT" in capital letters. "how to know if DMA is setup?" -- Usually the driver will output a line in the boot log. Otherwise it's architecture (e.g. Device Tree) or device driver specific. "You can point me to the location in the kernel source" -- "Stock" does not mean what you think it does. The mainline kernel is downloadable from kernel.org and viewable at lxr.free-electrons.com/source/?v=4.8. – sawdust