File:  [NetBSD Developer Wiki] / wikisrc / tutorials / cpu_frequency_scaling.mdwn
Revision 1.2: download - view: text, annotated - select for diffs
Sun Feb 5 07:14:36 2012 UTC (2 years, 2 months ago) by schmonz
Branches: MAIN
CVS tags: HEAD
dos2unix

How to throttle your CPU 

Basic support is in generic kernels by default. sysctl and sysutils/estd do the rest. 

**Contents**

[[!toc levels=3]]

#  i386 

##  AMD PowerNow! 
    
      options 	POWERNOW_K7
    

or 
    
      options 	POWERNOW_K8
    

accessible through e.g. 
    
      sysctl machdep.powernow.frequency.current
      sysctl machdep.powernow.frequency.available 
      sysctl -w machdep.powernow.frequency.target=600
    

##  Intel Speedstep 
    
      options 	ENHANCED_SPEEDSTEP
    

accessible through e.g. 
    
      sysctl machdep.est.frequency.current
      sysctl machdep.est.frequency.available
      sysctl -w machdep.est.frequency.target=600
    

##  speedstep-ich 

  * Available since NetBSD 2.0 
    
      ichlpcib* at pci? dev ? function ?
      isa0 at ichlpcib?
    

accessible through 
    
      sysctl -w machdep.speedstep_state=[0/1]
    

where 0 is a low state and 1 is a high state. 

##  speedstep-smi 

  * Available since NetBSD 4.0 
    
      piixpcib* at pci? dev ? function ?
      isa0 at piixpcib?
    

also accessible through 
    
      sysctl -w machdep.speedstep_state=[0/1]
    

##  Transmeta longrun 

  * Should be activated by default 

accessible through 
    
      machdep.tm_longrun_mode
      machdep.tm_longrun_frequency
      machdep.tm_longrun_voltage
      machdep.tm_percentage
    

#  amd64 

##  Cool'n'Quiet 

Same procedure as with PowerNow!: 
    
      options 	POWERNOW_K8
    

accessible through e.g. 
    
      sysctl machdep.powernow.frequency.current
      sysctl machdep.powernow.frequency.available 
      sysctl -w machdep.powernow.frequency.target=600
    

#  Setting up estd for automatic scaling 

The estd daemon dynamically sets the frequency on SpeedStep and PowerNow!-enabled CPUs depending on current CPU-utilization. It is written for systems running NetBSD or DragonFly. 
    
      cd /usr/pkgsrc/sysutils/estd
      make install clean
    

To make it start at boot-time 
    
      cp /usr/pkg/share/examples/rc.d/estd /etc/rc.d/
      chmod +x /etc/rc.d/estd
    

and add to /etc/rc.conf 
    
      estd="yes"
      estd_flags=""
    

then as root 
    
      /etc/rc.d/estd restart
    

  * Examples 

Maximize battery lifetime by limiting CPU-frequency to 1000 MHz and switching to lower speeds fast: 
    
      estd_flags="-d -b -M 1000"
    

Maximize performance by running at least at 1400MHz and switching to higher speeds real fast: 
    
      estd_flags="-d -a -m 1400"
    

Alternatively, you can start estd directly from /etc/rc.local instead of rc.conf/rc.d. 

More in the manual. 


CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb