wiki:DVFS

Version 2 (modified by Tim Harvey, 4 years ago) ( diff )

convert from html to wiki markup

Dynamic Voltage and Frequency Scaling (DVFS) - Ventana Only

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 Gateworks Ventana family based off the Freescale i.MX6 CPU family allows DVFS

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.

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

Each cpu has an entry in sysfs at /sys/devices/system/cpu/cpu<n>/cpufreq/ at /sys/devices/system/cpu with the following files:

  • 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

Examples:

  • show governor for cpu0
    cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    
  • show available frequencies (in MHz) for cpu0
    cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
    
  • set 'conservative' governor for a good mix of power-saving and performance
    echo conservative > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    
  • set to lowest power mode using the 'powersave' governor:
    echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    
  • set to highest performance mode using the 'performance' governor:
    echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    
  • set 'userspace' governer because perhaps you have a script that wants to adjust it manually based on your own criteria over time:
    echo userspace > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    echo 396000 > /sys/devices/system/cpu/cpu0/cpufreq/setspeed
    echo 792000 > /sys/devices/system/cpu/cpu0/cpufreq/setspeed
    echo 996000 > /sys/devices/system/cpu/cpu0/cpufreq/setspeed
    
Note: See TracWiki for help on using the wiki.