Skip to content

tty:serial:imx: use pm_qos to ward against wakeup latency

This is a fix for issue https://secogroup.atlassian.net/browse/YT-201 (Nallino: rs485echo test fails on high baudrates when size of message to transmit is bigger than UART FIFO bufffer)

During investigation of the issue it was found that:

  • when kernel reaches a UART FIFO to get received data in interrupt handler, we got an Overran Error in status register and some data is lost already;
  • so, kernel/hardware is just too slow to process incoming data;
  • herewith when we increased CPU frequency to maximum value, it has not helped. The only solution was to launch some stress test in parallel - in this case, kernel was able to process data from UART despite heavy load;
  • after that, we checked a NXP kernel and found that it is not affected by this issue;
  • so, we bisected that the problem is in cpuilde driver for IMX6ULL CPU in vanilla kernel. By contrast with NXP kernel, there is no iMX6ULL specific driver and a universal one (cpuidle-imx6sx.c) is used;
  • this universal driver does not use all hardware capabilities of iMX6ULL CPU, and because of this it's too slow in waking up CPU from LOW-POWER-IDLE state;
  • and this sloppiness results in following problems at least: x overrun errors in RX FIFO when UART operates on speeds higher than 115200 bps (https://secogroup.atlassian.net/issues/YT-201) x delays when RS485 switches from RX to TX, which causes ordinary RS485 tests to fail (https://secogroup.atlassian.net/issues/YT-136)

The proper solution, would be to port cpuidle-imx6ul.c from NXP kernel, but it would require reasonable efforts, as it does not work in vanilla out of box.

So, initially we just decided to disable a LOW-POWER-IDLE state for Nallino and prepared !335, but that solution was somewhat crude.

Plus Jonas Höppner pointed to linux-imx-kuk!560 (merged) where pm_qos was used to work around a similar problem on iMX8MP.

As a result, we have done the same on Nallino board with iMX6ULL CPU. In particular:

  • enabled pm_qos framework in serial driver to reduce latency for waking-up from idle state; ward against CPU wakeup latency;
  • made it possible to enable this workaround via device tree;
  • enabled this workaround in device tree for Nallino (instead of previous workaround for RS485 turnaround issue f049bdc6).
Edited by Mikhail Vanyulin

Merge request reports

Loading