Hello,
I have a custom platform(kernel version 5.4.188) that has an mx287 cpu. I'm using the auart1 to communicate with an MCU. The MCU is sending every 4ms some data. This set up is making the cpu load to be around 20% using the 'top' cmd.
This set up was working fine with ~0%-1% cpu load on an older kernel(2.36.35)
I have attached a test app(serialTest.c) to test the cpu MCU communication. On the 5.4.188 the cpu load is ~20% and on 2.36.35 is ~1%.
The dts bits from 5.4.188 on the custom board:
&auart1 {
pinctrl-names = "default";
pinctrl-0 = <&auart1_2pins_a>;
status = "okay";
};
the dts custom board includes the imx28.dtsi and uses this https://elixir.bootlin.com/linux/v5.4.188/source/arch/arm/boot/dts/imx28.dtsi#L324
When running the serialTest.c app, this is how the data is looking on the 5.4.188:
~# ./serialTest
15
15
15
I'm getting 15bytes because I've changed the FIFO level select from ONE_QUARTER(trigger on FIFO full to at least 4 from 16 entries) to SEVEN_EIGHTS(at least 14 of 16 entries) hence reducing the cpu load from ~20% to ~11%.
When running the serialTest.c app, this is how the data is looking on the 2.36.35:
~# ./serialTest
45
30
54
30
45
30
45
30
54
So, on 2.36.35 the read syscall is returning much more data. This is coming from the uart memory buffer(circular buffer) from my understanding. Once the FIFO hw buffer(16bytes) has at least ONE_QUARTER the interrupt will trigger, the cpu will copy the data from FIFO to the circular buffer. Later the read syscall will demand this data from the circular buffer.
What else I have tried?
I tried to see if there is a difference at the scheduler clock as there was some modifications to solve some kind of latencies issues. I saw that the drivers/clocksource/mxs_timer.c is running on Fixed Count mode and on the 2.36.35 this is running on Match Count mode. So, I've switched to Match Count mode to be aligned with the 2.36.35, but no performance improvement.
I tried to trigger the read syscall to return when the available data is greater than 30bytes(just to be aligned with the 2.6.35 kernel) and I tried to use the termios by modifying the VMIN field. Indeed the returned data is around the VMIN value, but still no significant improvement(I've observed a 2%improvement and reaching 9% cpu load)
So, I would like to see if there is some other pointers on this ? It sounds that whatever I try, everything narrows on that FIFO hw buffer. How is it that on 2.6.35 I get 0-1% cpu consumption and on the 5.4.188 I get ~11%(after changing the FIFO set level where on 2.6.35 there is no FIFO set level modification, just runs with the default one).
Note:
The 2.6.35 was not using DMA and on 5.4.188 this is conditioned by the existence of the rtc/cts signals which our custom platform does not have.
thank you