Skip to main content

CPU Frequency and DVFS (Linux)

Introduction

The Linux Kernel supports dynamic voltage and frequency switching (DVFS) in order to minimize power usage. Generally, the feature should remain enabled, however, if power consumption and heat dissipation aren't an issue and low latency is required, it might make sense to disable frequency scaling.

This article complies with the Typographic Conventions for Torizon Documentation.

Maximum Frequency by SoMs

The maximum frequency to be used depends on the SoC present in the module, see the table below:

ModuleMaximum frequency (kHz)
Colibri iMX6S/DL996000
Colibri iMX6 IT792000
Colibri IMX6ULL792000
Colibri iMX7S792000
Colibri iMX7DL996000
Colibri iMX8QXP1200000
Colibri T20/T20 IT996000
Colibri T301400000
Colibri T30 IT1000000
Apalis iMX6996000
Apalis iMX6 IT792000
Apalis iMX8QM/QP1596000 (A72)
1200000 (A53)
Apalis iMX8QXP1200000
Apalis T301400000
Apalis TK12070000
Verdin iMX8M Mini (IT)1600000
Verdin iMX8M Mini1800000
Verdin iMX8M Plus (IT)1600000
Verdin iMX8M Plus1800000
Verdin AM62 Solo800000
Verdin AM62 Solo (IT)1000000
Verdin AM62 Dual/Quad1400000
Verdin iMX951800000 (A55)
800000 (M7)
333000 (M33)
Aquila AM692000000 (A72)
1000000 (R5F)
info

Tegra modules can either have one or all cores enabled. This is controlled by the Linux kernel based on the CPU load. For instance, when the first CPU load goes to 100%, the other cores are enabled.

info

For the Apalis T30 and Colibri T30 (non-IT), the maximum CPU frequency depends on the number of cores enabled: 1 core 1.4GHz; 4 cores 1.3GHz. For the Colibri T30 IT, the maximum frequency is 1 GHz independent of the number of cores enabled.

info

For the Verdin iMX8M Mini/Plus (non-IT), the maximum CPU frequency is 1.8GHz, for IT SoC revisions the maximum CPU frequency is 1.6GHz.

CPU Governor

CPU governors can be viewed as preconfigured power settings for the CPU, for detailed information about governors consult this article.

Available governors can be seen through scaling_available_governors file:

# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
conservative userspace powersave ondemand performance

Change CPU frequency behavior by using an appropriate governor:

# echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

CPU Frequency

Available frequencies values can be seen through scaling_available_frequencies file:

# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
1200000 1600000

Change CPU frequency value by setting the CPU frequency explicitly:

# echo 1600000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
caution

The userspace governor must be set to change the frequency value.

The system will adjust to an appropriate voltage according to frequency. Please note that depending on the board/die temperature, thermal throttling might limit the current frequency in use.

How to change the CPU power profile on boot

By default, even if you change the CPU power profile using the CPU Governor, that profile reverts to the default after restarting the SoM. To address this, a service can be added to systemd to run during boot.

Looking for this, create this archive on this specific directory:

# sudo touch /etc/systemd/system/cpu-governor.service

Now, copy this configuration to the created archive /etc/systemd/system/cpu-governor.service:

[Unit]
Description=Performance CPU frequency governor

[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/bin/sh -c '\
echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor'
ExecStop=/bin/sh -c '\
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor'

[Install]
WantedBy=multi-user.target

To activate the service, run:

# sudo systemctl enable performance-cpu-governor.service

CPUPower Userspace Tools

The cpupower userspace tools can be used to achieve the same results as above.

Check the current frequency information:

# cpupower frequency-info
analyzing CPU 0:
driver: cpufreq-dt
CPUs which run at the same hardware frequency: 0 1 2 3
CPUs which need to have their frequency coordinated by software: 0 1 2 3
maximum transition latency: 182 us
hardware limits: 1.20 GHz - 1.60 GHz
available frequency steps: 1.20 GHz, 1.60 GHz
available cpufreq governors: conservative ondemand userspace powersave performance schedutil
current policy: frequency should be within 1.20 GHz and 1.60 GHz.
The governor "ondemand" may decide which speed to use
within this range.
current CPU frequency: Unable to call hardware
current CPU frequency: 1.20 GHz (asserted by call to kernel)

Change CPU frequency behavior to userspace:

# sudo cpupower frequency-set -g userspace

Change CPU frequency value by setting the CPU frequency explicitly:

# sudo cpupower frequency-set -f 1600000


Send Feedback!