cpufreq: intel_pstate: Account for non C0 time
authorPhilippe Longepe <philippe.longepe@intel.com>
Fri, 4 Dec 2015 16:40:32 +0000 (17:40 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 10 Dec 2015 00:17:40 +0000 (01:17 +0100)
commite70eed2b64545ab5c9d2f4d43372d79762f1b985
treedd00eb9d051a1ee5ba0bedd474cc1c085278ab31
parent157386b6fc1465f292b66c4133409033650ad335
cpufreq: intel_pstate: Account for non C0 time

The current function to calculate cpu utilization uses the average P-state
ratio (APerf/Mperf) scaled by the ratio of the current P-state to the
max available non-turbo one. This leads to an overestimation of
utilization which causes higher-performance P-states to be selected more
often and that leads to increased energy consumption.

This is a problem for low-power systems, so it is better to use a
different utilization calculation algorithm for them.

Namely, the Percent Busy value (or load) can be estimated as the ratio of the
MPERF counter that runs at a constant rate only during active periods (C0) to
the time stamp counter (TSC) that also runs (at the same rate) during idle.
That is:

Percent Busy = 100 * (delta_mperf / delta_tsc)

Use this algorithm for platforms with SoCs based on the Airmont and Silvermont
Atom cores.

Signed-off-by: Philippe Longepe <philippe.longepe@intel.com>
Signed-off-by: Stephane Gasparini <stephane.gasparini@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/intel_pstate.c