aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorDoug Smythies <doug.smythies@gmail.com>2014-06-17 16:36:10 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-06-17 16:57:40 -0400
commit51d211e9c334b9eca3505f4052afa660c3e0606b (patch)
treef515484b6eb8f1f5b75bfaa3ec969747a3b41706 /drivers/cpufreq
parent217886d3f3191f1f052e987740ee2bb32a4fd316 (diff)
intel_pstate: Correct rounding in busy calculation
There was a mistake in the actual rounding portion this previous patch: f0fe3cd7e12d (intel_pstate: Correct rounding in busy calculation) such that the rounding was asymetric and incorrect. Severity: Not very serious, but can increase target pstate by one extra value. For real world work flows the issue should self correct (but I have no proof). It is the equivalent of different PID gains for positive and negative numbers. Examples: -3.000000 used to round to -4, rounds to -3 with this patch. -3.503906 used to round to -5, rounds to -4 with this patch. Fixes: f0fe3cd7e12d (intel_pstate: Correct rounding in busy calculation) Signed-off-by: Doug Smythies <dsmythies@telus.net> Cc: 3.14+ <stable@vger.kernel.org> # 3.14+ Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/intel_pstate.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 4e7f492ad583..924bb2d42b1c 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -196,10 +196,7 @@ static signed int pid_calc(struct _pid *pid, int32_t busy)
196 pid->last_err = fp_error; 196 pid->last_err = fp_error;
197 197
198 result = pterm + mul_fp(pid->integral, pid->i_gain) + dterm; 198 result = pterm + mul_fp(pid->integral, pid->i_gain) + dterm;
199 if (result >= 0) 199 result = result + (1 << (FRAC_BITS-1));
200 result = result + (1 << (FRAC_BITS-1));
201 else
202 result = result - (1 << (FRAC_BITS-1));
203 return (signed int)fp_toint(result); 200 return (signed int)fp_toint(result);
204} 201}
205 202