Set the CPU frequency

In the Kirkstone release of the yocto Reference BSP for the Apalis imx8 the performance of our application is horrible. I noticed that in dunfell the governor setting is shedutil but on kirkstone it is ondemand. Do you have any recipes or support for setting governor and CPU frequency ? Would you recommend setting this on the kernel command line, in the device tree, or with a systemd service.

Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


In the Kirkstone release of the Yocto Reference BSP for the Apalis iMX8, the CPU governor is set to ‘ondemand’, which may not provide optimal performance compared to the ‘shedutil’ governor used in the Dunfell release. To address the performance issues you’re experiencing, it is advisable to switch back to ‘shedutil’ or another suitable governor.

For setting the governor and CPU frequency, the following methods are recommended:

  1. Kernel Command Line: This is generally recommended for persistent configurations as it allows for early configuration during boot, ensuring that the desired governor is applied consistently.

  2. Device Tree: Modifying the device tree can provide a more permanent configuration, but it may require recompilation and is less flexible than other methods.

  3. Systemd Service: This approach allows for dynamic adjustments based on system load and can be easier to manage across reboots. However, it may not be as effective for low-level settings like CPU frequency and governor, which are better handled at the kernel level.

Given your situation, using the kernel command line for setting the governor would be a good starting point. Testing different configurations in a controlled environment can help determine the best approach for your specific application needs.

Please, also check if these links can help you solve your problem:

Low Power Design: Lower CPU Frequencies.

You can replace the
CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
kernel option with
CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y.

or use the
# echo performance > /sys/devices/system/cpu/cpu<n>/cpufreq/scaling_governor
commands.

Excellent, thank you.