Changes between Version 1 and Version 2 of DVFS


Ignore:
Timestamp:
06/19/2020 05:32:34 PM (4 years ago)
Author:
Tim Harvey
Comment:

convert from html to wiki markup

Legend:

Unmodified
Added
Removed
Modified
  • DVFS

    v1 v2  
    1 {{{#!html
    2           <div id="wikipage" class="trac-content"><p>
    3 </p><div class="wiki-toc">
    4 <ol>
    5   <li>
    6     <a href="#DynamicVoltageandFrequencyScalingDVFS-VentanaOnly">Dynamic Voltage and Frequency Scaling (DVFS) - Ventana Only</a>
    7   </li>
    8   <li>
    9     <a href="#LinuxKernelDVFSAPI">Linux Kernel DVFS API</a>
    10     <ol>
    11       <li>
    12         <a href="#Governors">Governors</a>
    13       </li>
    14     </ol>
    15   </li>
    16 </ol>
    17 </div><p>
    18 </p>
    19 <h1 id="DynamicVoltageandFrequencyScalingDVFS-VentanaOnly">Dynamic Voltage and Frequency Scaling (DVFS) - Ventana Only</h1>
    20 <p>
    21 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'.
    22 </p>
    23 <p>
     1[[PageOutline]]
     2
     3= Dynamic Voltage and Frequency Scaling (DVFS) - Ventana Only
     4Modern 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'.
     5
    246The Gateworks Ventana family based off the Freescale i.MX6 CPU family allows DVFS
    25 </p>
    26 <h1 id="LinuxKernelDVFSAPI">Linux Kernel DVFS API</h1>
    27 <p>
    28 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.
    29 </p>
    30 <h2 id="Governors">Governors</h2>
    31 <p>
    32 Governors are kernel models that can drive CPU core frequency/voltage operating points based on an algorithm.  Currently the following governors exist:
    33 </p>
    34 <ul><li>performance - sets the frequency statically to the highest available CPU frequency
    35 </li><li>powersave -  sets the frequency statically to the lowest available CPU frequency
    36 </li><li>userspace - set the frequency from a userspace program
    37 </li><li>ondemand - adjust based on utilization
    38 </li><li>conservative - adjust based on utilization but be a bit more conservative by adjusting gradually
    39 </li></ul><p>
    40 Each cpu has an entry in sysfs at /sys/devices/system/cpu/cpu&lt;n&gt;/cpufreq/ at /sys/devices/system/cpuwith the following files:
    41 </p>
    42 <ul><li>scaling_governor - get/set the governor
    43 </li><li>scaling_available_governors - get the available governors
    44 </li><li>scaling_available_frequencies - get the available frequencies
    45 </li><li>cpuinfo_cur_freq - get/set the current freq
    46 </li><li>cpuinfo_max_freq - get/set the max freq
    47 </li><li>cpuinfo_min_freq - get/set the min freq
    48 </li><li>scaling_setspeed - set the current freq (if using the userspace governor)
    49 </li><li>affected_cpus - which cpu's are affected together
    50 </li></ul><p>
     7
     8= Linux Kernel DVFS API
     9The 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.
     10
     11== Governors
     12Governors are kernel models that can drive CPU core frequency/voltage operating points based on an algorithm. Currently the following governors exist:
     13 * performance - sets the frequency statically to the highest available CPU frequency
     14 * powersave - sets the frequency statically to the lowest available CPU frequency
     15 * userspace - set the frequency from a userspace program
     16 * ondemand - adjust based on utilization
     17 * conservative - adjust based on utilization but be a bit more conservative by adjusting gradually
     18
     19Each 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
    5129Examples:
    52 </p>
    53 <ul><li>show governor for cpu0
    54 <pre class="wiki">cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    55 </pre></li><li>show available frequencies (in MHz) for cpu0
    56 <pre class="wiki">cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
    57 </pre></li><li>set *conservative* governor for a good mix of power-saving and performance
    58 <pre class="wiki">echo conservative &gt; /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    59 </pre></li><li>set to lowest power mode using the *powersave* governor:
    60 <pre class="wiki">echo powersave &gt; /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    61 </pre></li><li>set to highest performance mode using the *performance* governor:
    62 <pre class="wiki">echo performance &gt; /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    63 </pre></li><li>set *userspace* governer because perhaps you have a script that wants to adjust it manually based on your own criteria over time:
    64 <pre class="wiki">echo userspace &gt; /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    65 echo 396000 &gt; /sys/devices/system/cpu/cpu0/cpufreq/setspeed
    66 echo 792000 &gt; /sys/devices/system/cpu/cpu0/cpufreq/setspeed
    67 echo 996000 &gt; /sys/devices/system/cpu/cpu0/cpufreq/setspeed
    68 </pre></li></ul
     30 * show governor for cpu0
     31{{{#!bash
     32cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    6933}}}
     34 * show available frequencies (in MHz) for cpu0
     35{{{#!bash
     36cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
     37}}}
     38 * set 'conservative' governor for a good mix of power-saving and performance
     39{{{#!bash
     40echo conservative > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
     41}}}
     42 * set to lowest power mode using the 'powersave' governor:
     43{{{#!bash
     44echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
     45}}}
     46 * set to highest performance mode using the 'performance' governor:
     47{{{#!bash
     48echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
     49}}}
     50 * set 'userspace' governer because perhaps you have a script that wants to adjust it manually based on your own criteria over time:
     51{{{#!bash
     52echo userspace > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
     53echo 396000 > /sys/devices/system/cpu/cpu0/cpufreq/setspeed
     54echo 792000 > /sys/devices/system/cpu/cpu0/cpufreq/setspeed
     55echo 996000 > /sys/devices/system/cpu/cpu0/cpufreq/setspeed
     56}}}