Tuesday, October 26, 2021

[SOLVED] Linux read() latency

Issue

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.Scope trace of data on line and read complete (blue)

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).


Solution

So in order to resolve this I had to write my own driver in the user space. It wasn't very difficult, just had figure out how to configure the chip properly. The chip is accessed using memory mapped IO. The memory offset could be read from /sys/dev/char/<major>:<minor>/iomem_base file.

enter image description here

Just need to make sure that the port is never opened. Otherwise the OS will try to read the same data.



Answered By - ilya1725