Changes between Initial Version and Version 1 of DVFS

10/22/2017 05:28:45 AM (5 years ago)



  • DVFS

    v1 v1  
     2          <div id="wikipage" class="trac-content"><p>
     3</p><div class="wiki-toc">
     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>
     19<h1 id="DynamicVoltageandFrequencyScalingDVFS-VentanaOnly">Dynamic Voltage and Frequency Scaling (DVFS) - Ventana Only</h1>
     21Modern 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'.
     24The Gateworks Ventana family based off the Freescale i.MX6 CPU family allows DVFS
     26<h1 id="LinuxKernelDVFSAPI">Linux Kernel DVFS API</h1>
     28The 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.
     30<h2 id="Governors">Governors</h2>
     32Governors are kernel models that can drive CPU core frequency/voltage operating points based on an algorithm.  Currently the following governors exist:
     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
     40Each cpu has an entry in sysfs at /sys/devices/system/cpu/cpu&lt;n&gt;/cpufreq/ at /sys/devices/system/cpuwith the following files:
     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
     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
     65echo 396000 &gt; /sys/devices/system/cpu/cpu0/cpufreq/setspeed
     66echo 792000 &gt; /sys/devices/system/cpu/cpu0/cpufreq/setspeed
     67echo 996000 &gt; /sys/devices/system/cpu/cpu0/cpufreq/setspeed