Changes between Version 2 and Version 3 of DVFS


Ignore:
Timestamp:
06/19/2020 10:16:45 PM (4 years ago)
Author:
Tim Harvey
Comment:

update examples to be more policy centric and fix setspeed example

Legend:

Unmodified
Added
Removed
Modified
  • DVFS

    v2 v3  
    11[[PageOutline]]
    22
    3 = Dynamic Voltage and Frequency Scaling (DVFS) - Ventana Only
     3= Dynamic Voltage and Frequency Scaling (DVFS)
    44Modern 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'.
    55
    6 The Gateworks Ventana family based off the Freescale i.MX6 CPU family allows DVFS
     6The following Gateworks product families support DVFS:
     7 - Ventana (i.MX6)
     8 - Venice (i.MX8)
    79
    810= Linux Kernel DVFS API
    911The 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.
     12
     13The {{{/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:
     14 * scaling_governor - get/set the governor
     15 * scaling_available_governors - get the available governors
     16 * scaling_available_frequencies - get the available frequencies
     17 * cpuinfo_cur_freq - get/set the current freq
     18 * cpuinfo_max_freq - get/set the max freq
     19 * cpuinfo_min_freq - get/set the min freq
     20 * scaling_setspeed - set the current freq (if using the userspace governor)
     21 * affected_cpus - which cpu's are affected together
     22
     23It is possible to have a system that groups cores into different policies.
    1024
    1125== Governors
     
    1731 * conservative - adjust based on utilization but be a bit more conservative by adjusting gradually
    1832
    19 Each cpu has an entry in sysfs at {{{/sys/devices/system/cpu/cpu<n>/cpufreq/}}} at {{{/sys/devices/system/cpu}}} with the following files:
    20  * scaling_governor - get/set the governor
    21  * scaling_available_governors - get the available governors
    22  * scaling_available_frequencies - get the available frequencies
    23  * cpuinfo_cur_freq - get/set the current freq
    24  * cpuinfo_max_freq - get/set the max freq
    25  * cpuinfo_min_freq - get/set the min freq
    26  * scaling_setspeed - set the current freq (if using the userspace governor)
    27  * affected_cpus - which cpu's are affected together
    28 
    29 Examples:
    30  * show governor for cpu0
     33== Examples
     34Here are some examples of using DVFS:
     35 * show affected cpu's for policy0:
     36{{{#!bash
     37cat /sys/devices/system/cpu/cpufreq/policy0/related_cpus
     38}}}
     39 * show governor for cpu0:
    3140{{{#!bash
    3241cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    3342}}}
    34  * show available frequencies (in MHz) for cpu0
     43 * show the governor for policy0:
    3544{{{#!bash
    36 cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
     45cat /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
     46}}}
     47 * show available frequencies (in MHz) for policy0
     48{{{#!bash
     49cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_frequencies
    3750}}}
    3851 * set 'conservative' governor for a good mix of power-saving and performance
    3952{{{#!bash
    40 echo conservative > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
     53echo conservative > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
    4154}}}
    4255 * set to lowest power mode using the 'powersave' governor:
    4356{{{#!bash
    44 echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
     57echo powersave > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
    4558}}}
    4659 * set to highest performance mode using the 'performance' governor:
    4760{{{#!bash
    48 echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
     61echo performance > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
    4962}}}
    5063 * set 'userspace' governer because perhaps you have a script that wants to adjust it manually based on your own criteria over time:
    5164{{{#!bash
    52 echo userspace > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    53 echo 396000 > /sys/devices/system/cpu/cpu0/cpufreq/setspeed
    54 echo 792000 > /sys/devices/system/cpu/cpu0/cpufreq/setspeed
    55 echo 996000 > /sys/devices/system/cpu/cpu0/cpufreq/setspeed
     65echo userspace > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
     66echo 396000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_setspeed
     67echo 792000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_setspeed
     68echo 996000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_setspeed
    5669}}}