cpufreq: intel_pstate: Correct the busy calculation for KNL
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Thu, 13 Jul 2017 22:03:51 +0000 (15:03 -0700)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 14 Jul 2017 01:01:28 +0000 (03:01 +0200)
commit6e34e1f23d780978da65968327cbba6d7013a73f
treee11a032791c000465112450a672b7919da5a9ec0
parentd4436c0dba8d4d780588179a2e192a867d266a10
cpufreq: intel_pstate: Correct the busy calculation for KNL

The busy percent calculated for the Knights Landing (KNL) platform
is 1024 times smaller than the correct busy value.  This causes
performance to get stuck at the lowest ratio.

The scaling algorithm used for KNL is performance-based, but it still
looks at the CPU load to set the scaled busy factor to 0 when the
load is less than 1 percent.  In this case, since the computed load
is 1024x smaller than it should be, the scaled busy factor will
always be 0, irrespective of CPU business.

This needs a fix similar to the turbostat one in commit b2b34dfe4d9a
(tools/power turbostat: KNL workaround for %Busy and Avg_MHz).

For this reason, add one more callback to processor-specific
callbacks to specify an MPERF multiplier represented by a number of
bit positions to shift the value of that register to the left to
copmensate for its rate difference with respect to the TSC.  This
shift value is used during CPU busy calculations.

Fixes: ffb810563c (intel_pstate: Avoid getting stuck in high P-states when idle)
Reported-and-tested-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: 4.6+ <stable@vger.kernel.org> # 4.6+
[ rjw: Changelog ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/intel_pstate.c