CPU Power Management
CPUs are one of largest consumers of power in PS when running at full load. Even on low loads, CPUs when left active can drain significant power. Linux kernel supports several CPU power management features which are discussed in this section.
Table of Contents
CPU Hotplug
Linux kernel supports CPU hotplug and this feature can be used to get the preferred number of CPUs online depending on the application. Taking a CPU offline turns-off the core thus saving power.
For example, having just one CPU online and pushing the remaining 3 CPUs offline saves around 130mW of power on ZU7EV part.
CPU hotplug feature can be enabled in Petalinux as shown below:
After booting up, the following commands can be used to push the CPUs to offline and then bring them back online when required:
# Push all secondary CPUs offline
echo 0 > /sys/devices/system/cpu/cpu1/online
echo 0 > /sys/devices/system/cpu/cpu2/online
echo 0 > /sys/devices/system/cpu/cpu3/online
# Bring back the CPUs online
echo 1 > /sys/devices/system/cpu/cpu1/online
echo 1 > /sys/devices/system/cpu/cpu2/online
echo 1 > /sys/devices/system/cpu/cpu3/online |
More info on CPU hotplug can be found in Linux documentation:
https://www.kernel.org/doc/Documentation/power/suspend-and-cpuhotplug.txt
CPU Idle
Linux kernel supports automatically idling of CPUs that are idle at runtime. This feature helps in automatically turning-off the cores that are idle to save power.
CPU Idle support can be enabled in Petalinux kernel config as shown below:
For applications that have very light or intermittent loads, this feature should provide a significant amount of power savings.
CPU Frequency Scaling
On ZU+, the APU cluster has four A53 cores. All the four cores are clocked by the same clock source apu_ref_clk. So, it should be noted that whenever clock scaling is applied, it is applied to all the four cores.
Linux supports CPU frequency scaling based on different governors. These settings can be enabled in Petalinux and controlled using sysfs entries at runtime.
The “userspace” governor enables users to switch between different CPU frequencies by means of sysfs interface. This governor can be used for experimenting and also in end applications where a custom closed loop switching of frequencies is desired.
Governors that perform automatic frequency scaling based on the load on CPUs are readily available in the Linux kernel and can be enabled as default governors depending on the nature of end application. For example, “ondemand” frequency governor can be used to automatically ramp up the CPU frequencies where there is load and ramp down when the system is on lighter loads.
Details on “cpufreq” governors can be found at https://www.kernel.org/doc/Documentation/cpu-freq/governors.txt
Here is a snapshot of Petalinux Kernel config showing available cpufreq governors:
There are open source applications available to control and monitor cpufreq governors and states. One such application which can be built from Petalinux is “cpufreq-info”. To enable this application, follow the screenshot below after running “petalinux-config -c rootfs”
Here is an example of using cpufreq-info utility to view the throttling of operating frequencies performed by the governor based on load.
$ cpufreq-info -s -m
300 MHz:70.68%, 400 MHz:0.03%, 600 MHz:0.00%, 1.20 GHz:29.29% (189) |
In the above log, it can be observed that the frequency was brought down to 300MHz for around 70% of the time.
Related Links
https://www.kernel.org/doc/Documentation/power/suspend-and-cpuhotplug.txt
https://www.kernel.org/doc/Documentation/cpu-freq/governors.txt
© Copyright 2019 - 2022 Xilinx Inc. Privacy Policy