I am running a system with RT-Preempt kernel v6.4.8-rt8
CPU is 12th Gen Intel(R) Core(TM) i7-12800HE
This system is receiving data through the CAN Bus. Every 1 millisecond a burst of 3 messages is received in the hardware CAN interface.
Most of the time (99.99998%) of the time the messages are available on the socket to be received within 1ms of the previous group.
But once per minute approximately, there is a delay of 4-6 ms in which the messages has been received in the hardware but is not available on the socket when calling
recv
.
Things I have checked:
- My application is calling deterministically recv
every 1ms, the data is not there.
- With candump
I get the confirmation that the messages are received every 1 ms by checking the hardware timestamp.
- The IRQ associated with the CAN device is bound to a CPU core (2) that is not used by my RT application (CPU core 6)
## The hack
If I execute stress --cpu 1
and bind the stress CPU core to the same core as the IRQ the delays disappear.
So I assume that a delay in waking up the CPU is causing the culprit.
I have tried all of the following to try to keep the CPU awake without using stress
.
- performance
/sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
- performance
/sys/devices/system/cpu/cpu2/cpufreq/energy_performance_preference
- idle=poll intel_idle.max_cstate=0
in /etc/default/grub
and update-grub; reboot
Still have delays with all these applied.
I am out of ideas, I cannot switch to acpi-cpufreq because it does not respect the integrated GPU power consumption (which is not being used during these tests).
Any other knobs I can turn to decrease that latency or ways I can understand the root issue?
Asked by Victor
(121 rep)
Jan 22, 2025, 12:20 PM