[[PageOutline]] = Dynamic Voltage and Frequency Scaling (DVFS) Modern processors allow their core clocks to be scaled in order to trade-off performance vs power or simple to save power when performance is not needed. This is referred to as 'Dynamic Frequency Scaling'. In some cases processors also allow you to scale the core voltages down when using lower clock-speeds which is referred to as 'Dynamic Voltage Scaling'. The following Gateworks product families support DVFS: - Ventana (i.MX6) - Venice (i.MX8) = Linux Kernel DVFS API The linux kernel provides a DVFS framework that allows each CPU core to have a min/max frequency and a governor that governs it. A sysfs API exists which is used by the cpufreq-utils package. The {{{/sys/devices/system/cpu/cpufreq/}}} directory will exist if you have hardware that supports dynamic frequency control and a cpufreq driver. That directory will have one or more policy nodes (ie policy0) which itself has the following nodes: * scaling_governor - get/set the governor * scaling_available_governors - get the available governors * scaling_available_frequencies - get the available frequencies * cpuinfo_cur_freq - get/set the current freq * cpuinfo_max_freq - get/set the max freq * cpuinfo_min_freq - get/set the min freq * scaling_setspeed - set the current freq (if using the userspace governor) * affected_cpus - which cpu's are affected together It is possible to have a system that groups cores into different policies. == Governors Governors are kernel models that can drive CPU core frequency/voltage operating points based on an algorithm. Currently the following governors exist: * performance - sets the frequency statically to the highest available CPU frequency * powersave - sets the frequency statically to the lowest available CPU frequency * userspace - set the frequency from a userspace program * ondemand - adjust based on utilization * conservative - adjust based on utilization but be a bit more conservative by adjusting gradually == Examples Here are some examples of using DVFS: * show affected cpu's for policy0: {{{#!bash cat /sys/devices/system/cpu/cpufreq/policy0/related_cpus }}} * show governor for cpu0: {{{#!bash cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor }}} * show the governor for policy0: {{{#!bash cat /sys/devices/system/cpu/cpufreq/policy0/scaling_governor }}} * show available frequencies (in MHz) for policy0 {{{#!bash cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_frequencies }}} * set 'conservative' governor for a good mix of power-saving and performance {{{#!bash echo conservative > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor }}} * set to lowest power mode using the 'powersave' governor: {{{#!bash echo powersave > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor }}} * set to highest performance mode using the 'performance' governor: {{{#!bash echo performance > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor }}} * set 'userspace' governer because perhaps you have a script that wants to adjust it manually based on your own criteria over time: {{{#!bash echo userspace > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor echo 396000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_setspeed echo 792000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_setspeed echo 996000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_setspeed }}}