Power Management for the CPU - 2021.2 English

Zynq UltraScale+ MPSoC Software Developer Guide

Document ID
UG1137
Release Date
2021-10-27
Version
2021.2 English

CPU Hotplug

The user may take one or more APU cores on-line and off-line as needed through the CPU Hotplug control interface.

Kernel configurations required:

  • Kernel Features
    • [*] Support for hot-pluggable CPUs

See also:

For example, to take CPU3 off-line:

$ echo 0 > /sys/devices/system/cpu/cpu3/online

CPU Idle

If enabled, the kernel may cut power to individual APU cores when they are idling. The kernel configurations required are:

  • CPU Power Management
    • CPU Idle
      • [*] CPU idle PM support
      • Arm CPU Idle Drivers
        • [*] Generic Arm/Arm64 CPU idle Driver

See also:

Below is the sysfs interface for cpuidle.

$ ls -lR /sys/devices/system/cpu/cpu0/cpuidle/

/sys/devices/system/cpu/cpu0/cpuidle/:
drwxr-xr-x	2 root	root	0	Jun	10	21:55	state0
drwxr-xr-x	2 root	root	0	Jun	10	21:55	state1

/sys/devices/system/cpu/cpu0/cpuidle/state0:
-r--r--r--	1	root	root	4096	Jun	10	21:55	desc
-rw-r--r--	1	root	root	4096	Jun	10	21:55	disable
-r--r--r--	1	root	root	4096	Jun	10	21:55	latency
-r--r--r--	1	root	root	4096	Jun	10	21:55	name
-r--r--r--	1	root	root	4096	Jun	10	21:55	power
-r--r--r--	1	root	root	4096	Jun	10	21:55	residency
-r--r--r--	1	root	root	4096	Jun	10	21:55	time
-r--r--r--	1	root	root	4096	Jun	10	21:55	usage

/sys/devices/system/cpu/cpu0/cpuidle/state1:
-r--r--r--	1	root	root	4096	Jun	10	21:55	desc
-rw-r--r--	1	root	root	4096	Jun	10	21:55	disable
-r--r--r--	1	root	root	4096	Jun	10	21:55	latency
-r--r--r--	1	root	root	4096	Jun	10	21:55	name
-r--r--r--	1	root	root	4096	Jun	10	21:55	power
-r--r--r--	1	root	root	4096	Jun	10	21:55	residency
-r--r--r--	1	root	root	4096	Jun	10	21:55	time
-r--r--r--	1	root	root	4096	Jun	10	21:55	usage

where:

  • desc: Small description about the idle state (string)
  • disable: Option to disable this idle state (bool)
  • latency: Latency to exit out of this idle state (in microseconds)
  • name: Name of the idle state (string)
  • power: Power consumed while in this idle state (in milliwatts)
  • time: Total time spent in this idle state (in microseconds)
  • usage: Number of times this state was entered (count)

Below is the sysfs interface for cpuidle governors.

$ ls -lR /sys/devices/system/cpu/cpuidle/
/sys/devices/system/cpu/cpuidle/:
-r--r--r--	1 root	root	4096 Jun 10 21:55 current_driver
-r--r--r--	1 root	root	4096 Jun 10 21:55 current_governor_ro

CPU Frequency

If enabled, the CPU cores may switch between different operation clock frequencies. The kernel configurations required are:

  • CPU Frequency scaling
    • [*] CPU Frequency scaling
    • Default CPUFreq governor
      • Userspace
  • CPU Power Management
    • [*] CPU Frequency scaling
    • Default CPUFreq governor
      • Userspace
      • <*> Generic DT based cpufreq driver

Look up the available CPU speeds:

$ cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cpu_freq

Select the 'userspace' governor for CPU frequency control:

$ echo userspace > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

Look up the current CPU speed (same for all cores):

$ cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cpu_freq

Change the CPU speed (same for all cores):

$ echo <freq> > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed

For details on adding and changing CPU frequencies, see the Linux kernel documentation on Generic Operating Points.