From: Greg Kroah-Hartman Date: Tue, 11 Feb 2014 18:45:26 +0000 (-0800) Subject: 3.10-stable patches X-Git-Tag: v3.4.80~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2b8f8e3f8179687146f9e0a23a75e49c485a689d;p=thirdparty%2Fkernel%2Fstable-queue.git 3.10-stable patches added patches: intel_pstate-add-haswell-cpu-models.patch intel_pstate-correct-calculation-of-min-pstate-value.patch intel_pstate-fix-no_turbo.patch intel_pstate-improve-accuracy-by-not-truncating-until-final-result.patch --- diff --git a/queue-3.10/intel_pstate-add-haswell-cpu-models.patch b/queue-3.10/intel_pstate-add-haswell-cpu-models.patch new file mode 100644 index 00000000000..8d774371836 --- /dev/null +++ b/queue-3.10/intel_pstate-add-haswell-cpu-models.patch @@ -0,0 +1,37 @@ +From 6cdcdb793791f776ea9408581b1242b636d43b37 Mon Sep 17 00:00:00 2001 +From: Nell Hardcastle +Date: Sun, 30 Jun 2013 15:58:57 -0700 +Subject: intel_pstate: Add Haswell CPU models + +From: Nell Hardcastle + +commit 6cdcdb793791f776ea9408581b1242b636d43b37 upstream. + +Enable the intel_pstate driver for Haswell CPUs. One missing Ivy Bridge +model (0x3E) is also included. Models referenced from +tools/power/x86/turbostat/turbostat.c:has_nehalem_turbo_ratio_limit + +Signed-off-by: Nell Hardcastle +Acked-by: Viresh Kumar +Acked-by: Dirk Brandewie +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/cpufreq/intel_pstate.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/cpufreq/intel_pstate.c ++++ b/drivers/cpufreq/intel_pstate.c +@@ -523,6 +523,11 @@ static const struct x86_cpu_id intel_pst + ICPU(0x2a, default_policy), + ICPU(0x2d, default_policy), + ICPU(0x3a, default_policy), ++ ICPU(0x3c, default_policy), ++ ICPU(0x3e, default_policy), ++ ICPU(0x3f, default_policy), ++ ICPU(0x45, default_policy), ++ ICPU(0x46, default_policy), + {} + }; + MODULE_DEVICE_TABLE(x86cpu, intel_pstate_cpu_ids); diff --git a/queue-3.10/intel_pstate-correct-calculation-of-min-pstate-value.patch b/queue-3.10/intel_pstate-correct-calculation-of-min-pstate-value.patch new file mode 100644 index 00000000000..5101c0cd08b --- /dev/null +++ b/queue-3.10/intel_pstate-correct-calculation-of-min-pstate-value.patch @@ -0,0 +1,39 @@ +From 7244cb62d96e735847dc9d08f870550df896898c Mon Sep 17 00:00:00 2001 +From: Dirk Brandewie +Date: Mon, 21 Oct 2013 09:20:33 -0700 +Subject: intel_pstate: Correct calculation of min pstate value + +From: Dirk Brandewie + +commit 7244cb62d96e735847dc9d08f870550df896898c upstream. + +The minimum pstate is supposed to be a percentage of the maximum P +state available. Calculate min using max pstate and not the +current max which may have been limited by the user + +Signed-off-by: Dirk Brandewie +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/cpufreq/intel_pstate.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/drivers/cpufreq/intel_pstate.c ++++ b/drivers/cpufreq/intel_pstate.c +@@ -366,12 +366,13 @@ static int intel_pstate_turbo_pstate(voi + static void intel_pstate_get_min_max(struct cpudata *cpu, int *min, int *max) + { + int max_perf = cpu->pstate.turbo_pstate; ++ int max_perf_adj; + int min_perf; + if (limits.no_turbo) + max_perf = cpu->pstate.max_pstate; + +- max_perf = fp_toint(mul_fp(int_tofp(max_perf), limits.max_perf)); +- *max = clamp_t(int, max_perf, ++ max_perf_adj = fp_toint(mul_fp(int_tofp(max_perf), limits.max_perf)); ++ *max = clamp_t(int, max_perf_adj, + cpu->pstate.min_pstate, cpu->pstate.turbo_pstate); + + min_perf = fp_toint(mul_fp(int_tofp(max_perf), limits.min_perf)); diff --git a/queue-3.10/intel_pstate-fix-no_turbo.patch b/queue-3.10/intel_pstate-fix-no_turbo.patch new file mode 100644 index 00000000000..b19d41c23a4 --- /dev/null +++ b/queue-3.10/intel_pstate-fix-no_turbo.patch @@ -0,0 +1,36 @@ +From 1ccf7a1cdafadd02e33e8f3d74370685a0600ec6 Mon Sep 17 00:00:00 2001 +From: Srinivas Pandruvada +Date: Tue, 1 Oct 2013 10:28:41 -0700 +Subject: intel_pstate: fix no_turbo + +From: Srinivas Pandruvada + +commit 1ccf7a1cdafadd02e33e8f3d74370685a0600ec6 upstream. + +When sysfs for no_turbo is set, then also some p states in turbo regions +are observed. This patch will set IDA Engage bit when no_turbo is set to +explicitly disengage turbo. + +Signed-off-by: Srinivas Pandruvada +Acked-by: Dirk Brandewie +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/cpufreq/intel_pstate.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/cpufreq/intel_pstate.c ++++ b/drivers/cpufreq/intel_pstate.c +@@ -394,7 +394,10 @@ static void intel_pstate_set_pstate(stru + trace_cpu_frequency(pstate * 100000, cpu->cpu); + + cpu->pstate.current_pstate = pstate; +- wrmsrl(MSR_IA32_PERF_CTL, pstate << 8); ++ if (limits.no_turbo) ++ wrmsrl(MSR_IA32_PERF_CTL, BIT(32) | (pstate << 8)); ++ else ++ wrmsrl(MSR_IA32_PERF_CTL, pstate << 8); + + } + diff --git a/queue-3.10/intel_pstate-improve-accuracy-by-not-truncating-until-final-result.patch b/queue-3.10/intel_pstate-improve-accuracy-by-not-truncating-until-final-result.patch new file mode 100644 index 00000000000..22732f8b43a --- /dev/null +++ b/queue-3.10/intel_pstate-improve-accuracy-by-not-truncating-until-final-result.patch @@ -0,0 +1,119 @@ +From d253d2a52676cfa3d89b8f0737a08ce7db665207 Mon Sep 17 00:00:00 2001 +From: Brennan Shacklett +Date: Mon, 21 Oct 2013 09:20:32 -0700 +Subject: intel_pstate: Improve accuracy by not truncating until final result + +From: Brennan Shacklett + +commit d253d2a52676cfa3d89b8f0737a08ce7db665207 upstream. + +This patch addresses Bug 60727 +(https://bugzilla.kernel.org/show_bug.cgi?id=60727) +which was due to the truncation of intermediate values in the +calculations, which causes the code to consistently underestimate the +current cpu frequency, specifically 100% cpu utilization was truncated +down to the setpoint of 97%. This patch fixes the problem by keeping +the results of all intermediate calculations as fixed point numbers +rather scaling them back and forth between integers and fixed point. + +References: https://bugzilla.kernel.org/show_bug.cgi?id=60727 +Signed-off-by: Brennan Shacklett +Acked-by: Dirk Brandewie +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/cpufreq/intel_pstate.c | 33 +++++++++++++++------------------ + 1 file changed, 15 insertions(+), 18 deletions(-) + +--- a/drivers/cpufreq/intel_pstate.c ++++ b/drivers/cpufreq/intel_pstate.c +@@ -48,7 +48,7 @@ static inline int32_t div_fp(int32_t x, + } + + struct sample { +- int core_pct_busy; ++ int32_t core_pct_busy; + u64 aperf; + u64 mperf; + int freq; +@@ -68,7 +68,7 @@ struct _pid { + int32_t i_gain; + int32_t d_gain; + int deadband; +- int last_err; ++ int32_t last_err; + }; + + struct cpudata { +@@ -153,16 +153,15 @@ static inline void pid_d_gain_set(struct + pid->d_gain = div_fp(int_tofp(percent), int_tofp(100)); + } + +-static signed int pid_calc(struct _pid *pid, int busy) ++static signed int pid_calc(struct _pid *pid, int32_t busy) + { +- signed int err, result; ++ signed int result; + int32_t pterm, dterm, fp_error; + int32_t integral_limit; + +- err = pid->setpoint - busy; +- fp_error = int_tofp(err); ++ fp_error = int_tofp(pid->setpoint) - busy; + +- if (abs(err) <= pid->deadband) ++ if (abs(fp_error) <= int_tofp(pid->deadband)) + return 0; + + pterm = mul_fp(pid->p_gain, fp_error); +@@ -176,8 +175,8 @@ static signed int pid_calc(struct _pid * + if (pid->integral < -integral_limit) + pid->integral = -integral_limit; + +- dterm = mul_fp(pid->d_gain, (err - pid->last_err)); +- pid->last_err = err; ++ dterm = mul_fp(pid->d_gain, fp_error - pid->last_err); ++ pid->last_err = fp_error; + + result = pterm + mul_fp(pid->integral, pid->i_gain) + dterm; + +@@ -435,8 +434,9 @@ static inline void intel_pstate_calc_bus + struct sample *sample) + { + u64 core_pct; +- core_pct = div64_u64(sample->aperf * 100, sample->mperf); +- sample->freq = cpu->pstate.max_pstate * core_pct * 1000; ++ core_pct = div64_u64(int_tofp(sample->aperf * 100), ++ sample->mperf); ++ sample->freq = fp_toint(cpu->pstate.max_pstate * core_pct * 1000); + + sample->core_pct_busy = core_pct; + } +@@ -468,22 +468,19 @@ static inline void intel_pstate_set_samp + mod_timer_pinned(&cpu->timer, jiffies + delay); + } + +-static inline int intel_pstate_get_scaled_busy(struct cpudata *cpu) ++static inline int32_t intel_pstate_get_scaled_busy(struct cpudata *cpu) + { +- int32_t busy_scaled; + int32_t core_busy, max_pstate, current_pstate; + +- core_busy = int_tofp(cpu->samples[cpu->sample_ptr].core_pct_busy); ++ core_busy = cpu->samples[cpu->sample_ptr].core_pct_busy; + max_pstate = int_tofp(cpu->pstate.max_pstate); + current_pstate = int_tofp(cpu->pstate.current_pstate); +- busy_scaled = mul_fp(core_busy, div_fp(max_pstate, current_pstate)); +- +- return fp_toint(busy_scaled); ++ return mul_fp(core_busy, div_fp(max_pstate, current_pstate)); + } + + static inline void intel_pstate_adjust_busy_pstate(struct cpudata *cpu) + { +- int busy_scaled; ++ int32_t busy_scaled; + struct _pid *pid; + signed int ctl = 0; + int steps; diff --git a/queue-3.10/series b/queue-3.10/series index ad4649baa20..4d0a93e71d8 100644 --- a/queue-3.10/series +++ b/queue-3.10/series @@ -73,3 +73,7 @@ timekeeping-fix-clock_tai-timer-nanosleep-delays.patch timekeeping-fix-missing-timekeeping_update-in-suspend-path.patch rtc-cmos-add-an-alarm-disable-quirk.patch timekeeping-avoid-possible-deadlock-from-clock_was_set_delayed.patch +intel_pstate-add-haswell-cpu-models.patch +intel_pstate-fix-no_turbo.patch +intel_pstate-improve-accuracy-by-not-truncating-until-final-result.patch +intel_pstate-correct-calculation-of-min-pstate-value.patch