CPUFreq HAL [PSARC/2007/679 FastTrack timeout 12/12/2007]

David Chieu dchieu at sac.sfbay.sun.com
Wed Dec 5 10:50:54 PST 2007


Template Version: @(#)sac_nextcase 1.64 07/13/07 SMI
This information is Copyright 2007 Sun Microsystems
1. Introduction
    1.1. Project/Component Working Name:
	 CPUFreq HAL
    1.2. Name of Document Author/Supplier:
	 Author:  Anup Pemmaiah
    1.3  Date of This Document:
	05 December, 2007

4. Technical Description

4.0 Introduction
===============
This project delivers the CPU power management related support
for the HAL interfaces used by the GNOME Power Manager (GPM)
desktop application to control CPU power management behavior.

4.1 Background and Summary
=========================

LSARC/2006/462 proposed adding GNOME Power Manager (GPM), a
workstation power management GUI, to the Solaris GNOME desktop.
One of the components provided by GPM is a preference dialog used
to configure CPU power management settings. In order to support
the CPU power management dialog, the host OS (Solaris) is required
to provide backend support for the pre-defined Hardware Abstraction
Layer (HAL) interfaces [1]. See PSARC/2005/399 for more information
on HAL.

HAL defines a CPU Freq interface that it uses to support CPU power
management. This case, defines those interfaces and explains what 
existing Solaris interfaces will be used to support the HAL CPU Freq
interface.

4.2 Block Diagram
=================

An end-to-end GNOME CPU power management system diagram. 
The dotted lines indicate the boundaries of the pieces 
implemented by this project.

  +--------------------------+
  |                          |
  |GNOME CPU power management| LSARC/2006/462 GNOME-2.16 
  |    applet GUI            |
  +--------------------------+
             ^
             | (D-bus)
             |                           JDS consolidation (up)
-------------+--------------------------------------------------
             |                           ON consolidation (below)
             | (D-bus)
             v
   +-------------------------+
   |    HAL daemon (hald)    | PSARC/2005/399 Tamarack
 ...............................
 : |                         | :
 : +--------------------+    | :
 : | CPU Freq           |    | :
 : | daemon             |    | :    +-----------+
 : | hald-addon-cpufreq |    |<---->| kstat(1M) |
 : +--------------------+----+ :    +-----------+ 
 :	   ^		       :	  ^
 :.........|...................:	  |
	   |				  |
	   |				  |
	   v				  |
   +-------------------------+		  |
   |	power.conf	     |		  |
   |			     |		  |	
   |	pmconfig utility     |		  |
   +-------------------------+		  |
           ^				  |
           |				  |
           | (ioctl)                      |          USER
-----------+------------------------------+---------------
           |                              |          KERNEL
           |				  |
	   v				  |
   +------------------+                   |
   |                  |                   | (kstat)
   | cpu driver       |<------------------+
   |                  |         
   +------------------+         



4.3 Project Details
==================

4.3.1 Data flow of CPU Freq HAL method interface
----------------------------------------------

GPM uses the HAL CPU Freq Interface to manage CPU power management
policies on the host workstation. The Interface has one major CPU power
management concept of interest to this case. HAL refers to CPU power
management policy types as governors. The two governors that this case
intends to support initially are the "On Demand" governor and the
"Performance" governor.

The "On Demand" governor is a CPU power management policy whereby
dynamic CPU frequency scaling is performed by monitoring CPU utilization
and scaling the frequency when appropriate.

The "Performance" governor is a CPU power management policy intended
to allow the desktop to get full CPU utilization all the time (i.e.,
no frequency scaling).

Both governors will be implemented using the power.conf(4) cpupm keyword
introduced by PSARC/2005/067. "On Demand" translates to cpupm being
enabled and "Performance" translates to cpupm being disabled.

Also of interest to this case, is that the CPU Freq interface supports
defining a performance property for governors. The performance property
is meant to provide the governor with a hint at how aggressively it should
manage CPU power. This case proposes to use the frequency performance
attribute as a means of calculating a cpu-threshold value for 
power.conf(4). The cpu-threshold keyword was introduced by PSARC/2005/067.


4.3.2 Interfaces
--------------

Interfaces Exported:

	All the interfaces exported by this project are HAL 
	cpu-freq related and detailed information can be found
	on the HAL webpage [1]. They are "Committed" level. 
        These interfaces can be used by GPM.


   Interface 
   Method Name		Return	  Parameters		Comments
   -------------------------------------------------------------------

   SetCPUFreqGovernor	 void	   string 	Type of governor (policy) 							to set as described in 3.1.
				
   GetCPUFreqGovernor	 string	   None		Returns current policy


   GetCPUFreqAvailable	 string[]  None		Returns the list of 	
   Governors					supported policies

   SetCPUFreqPerformance  void	   int		Set the performance of the
		 	      (between 1-100)	CPU Freq scaling. Higher 							the value is better perfo-
						rmance. In our implementa-
						tion, this value is used 							to set the CPU Freq 							scaling by varying the
		 				"cpu-threshold" parameter
						in the power.conf.

   GetCPUFreqPerformance  int	   None		Return the current 	
						performance value set by
						SetCPUFreqPerformance

   SetCPUFreqConsiderNice  void	   Bool 	Whether or not niced processes
				 (consider	should be considered on CPU
				   niced	load calculation.
				   processes)	Note: Since none of the current
						CPU power management policies
						consider niced processes this
						method just returns 
						CPUFreq.NoSuitableGovernor)

   GetCPUFreqConsiderNice  bool    None		Whether nice'ed processes 
						are considered by the governor.
						Note: Since none of the current
						CPU power management policies
						consider niced processes this
						method just returns 
						CPUFreq.NoSuitableGovernor)


	The processor specific properties interface

   Interface		Type 			Comments
   ---------------------------------------------------------------

   processor.number	int		The internal processor number

   processor.throttle	boolean		Whether the processor supports
					throttling to decrease it's own
					clock speed

   processor.maximum_speed  long	The maximum speed of the processor
					in units of MHz


Interfaces Imported:

   Interface				Comments
   ---------------------------------------------------------------
   power.conf(4)	Used by SetCPUFreqGovernor & SetCPUPerformance to
			edit the "cpupm" & "cpu-threshold" parameters in
			power.conf respectively. The other method
			interfaces reads these values and return the 
			current values that are set

   pmconfig(1M)		When power.conf is edited anytime, pmconfig should
			be called for the edited power.conf to take effect

   cpu_info kstat 	Used by HAL cpu freq interface to get the max
   "clock_MHz" 		supported freq

   cpu_info kstat	To check if processor supports power management
   "supported_frequencies_Hz"



FOOTNOTES:
==========

[1] More info about HAL interface can be found at
	http://people.freedesktop.org/~david/hal-spec/hal-spec.html

6. Resources and Schedule
    6.4. Steering Committee requested information
   	6.4.1. Consolidation C-team Name:
		ON
    6.5. ARC review type: FastTrack
    6.6. ARC Exposure: open




More information about the opensolaris-arc mailing list