2023-04-13 02:27 AM
I am trying to achieve hard real-time under 100us on the STM32MP157f-eval, specifically, on the Cortex A7 dual core.
Note: I specifically target the Cortex A7 cores because the M4 is already taken for other tasks which requires much smaller latency.
What I did so far is:
After all those efforts, the jitter did not improved, and I still get >1ms jitter when applying load for enough time.
------------------------------
My next step is to ensure that the cpu frequency is not throttled.
I read https://wiki.st.com/stm32mpu/wiki/How_to_change_the_CPU_frequency but it's not yet clear to me how to check and set this.
Also, most general questions found on internet don't seem to apply to this architecture.
How to check that cpu frequency is at maximum performance and not throttled?
----------------------------
When using the following command:
$ perf stat -a -A --timeout 10000
CPU0 10003.99 msec cpu-clock # 1.000 CPUs utilized
CPU1 10003.97 msec cpu-clock # 1.000 CPUs utilized
CPU0 184937 context-switches # 18.486 K/sec
CPU1 8410 context-switches # 840.666 /sec
CPU0 1 cpu-migrations # 0.100 /sec
CPU1 1 cpu-migrations # 0.100 /sec
CPU0 0 page-faults # 0.000 /sec
CPU1 0 page-faults # 0.000 /sec
CPU0 6498043474 cycles # 0.650 GHz
CPU1 176739089 cycles # 0.018 GHz
CPU0 2838852339 instructions # 0.44 insn per cycle
CPU1 52273406 instructions # 0.30 insn per cycle
CPU0 471022215 branches # 47.083 M/sec
CPU1 5995202 branches # 599.282 K/sec
CPU0 108715456 branch-misses # 23.08% of all branches
CPU1 1995755 branch-misses # 33.29% of all branches
The cycles don't match the maximum, I deduce that the frequency is throttled down.
Solved! Go to Solution.
2023-04-17 12:36 AM
@A.M. ,
Do you have a netdata service that is running on your target ? It can be easily used to check the CPU frequency over the time. (link here: https://wiki.st.com/stm32mpu/wiki/Netdata)
Rgs,
Erwan.
2023-04-14 01:01 AM
Hi @A.M. ,
I see that you tried to apply PREEMP-RT patches on our Linux Kernel. Did you take the patches directly from the community or did you use our X-LINUX-RT expansion package ?
If not, please look at this article that can provide you some hints: https://wiki.st.com/stm32mpu/wiki/X-LINUX-RT_OpenSTLinux_Expansion_Package
Kind regards,
Erwan.
2023-04-14 02:30 AM
Hi @A.M.
To check and affect governor, you either keep only fastest OPP in the device tree or you could try to change it at run time:
cat /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
cat /sys/devices/system/cpu/cpufreq/policy0/scaling_cur_freq
cat /sys/kernel/debug/regulator/regulator_summary | sed -n -e "1p;2p;/vddcore/p"
cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_frequencies
cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_governors
echo performance > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
cat /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
cat /sys/devices/system/cpu/cpufreq/policy0/scaling_cur_freq
cat /sys/kernel/debug/regulator/regulator_summary | sed -n -e "1p;2p;/vddcore/p"
Regards.
2023-04-17 12:23 AM
Thank you for your replies.
1) Which PREEMPT-RT patch did I use?: I took the yocto layer from https://github.com/PRG-MPU-ALPHA/meta-st-x-linux-rt. (Witch is the same repo than https://github.com/STMicroelectronics/meta-st-x-linux-rt, before it was made public).
2) @PatrickF cat /sys/devices/system/cpu/cpufreq does not exists. I think this is one of the changes made by the PREEMPT_RT layer, according to the answer from Ewan SZYMANSKI.
From those two points, I deduce that the frequency scaling is disabled and always at maximum frequency. Is there a way to check this?
Because from the `perf` results, it look like the CPU frequency is adjusted, which could be a reason for my jitter. It might also be that `perf` tool is not counting `nop` when the core is idle.
2023-04-17 12:36 AM
@A.M. ,
Do you have a netdata service that is running on your target ? It can be easily used to check the CPU frequency over the time. (link here: https://wiki.st.com/stm32mpu/wiki/Netdata)
Rgs,
Erwan.
2023-04-18 09:08 AM
Hi @Erwan SZYMANSKI
Netdata is running, and it was a great discovery to troubleshoot performance.
I could not find any "CPU frequency" there, the cpu usage (<10%) suggest it is at maximum performance, not sure if I missed something.
Regards,
A. Maire
2023-04-18 11:39 PM
Hi @A.M. ,
In the netdata webpage, under "CPU" category, you should see cpufreq graphic.
It shows you the period of time when the CPU run at 800MHz or 650MHz in the case of an MP15 rev F.
Kind regards,
Erwan.
2023-04-19 05:30 AM
Hmm, seems not.
Doesn't matter. Thank you.