aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/intel_pstate.c
diff options
context:
space:
mode:
authorDoug Smythies <doug.smythies@gmail.com>2015-06-02 00:12:34 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-06-09 20:08:27 -0400
commit6c1e45917dec5e7c99ba8125fd8cc50f6e482a21 (patch)
treeee9a465fc93905b7e3a4a51604d18c33fca01f60 /drivers/cpufreq/intel_pstate.c
parentf16255eb930173f386db0ce78ed41401aa8a94a6 (diff)
intel_pstate: Force setting target pstate when required
During initialization and exit it is possible that the target pstate might not actually be set. Furthermore, the result can be that the driver and the processor are out of synch and, under some conditions, the driver might never send the processor the proper target pstate. This patch adds a bypass or do_checks flag to the call to intel_pstate_set_pstate. If bypass, then specifically bypass clamp checks and the do not send if it is the same as last time check. If do_checks, then, and as before, do the current policy clamp checks, and do not do actual send if the new target is the same as the old. Signed-off-by: Doug Smythies <dsmythies@telus.net> Reported-by: Marien Zwart <marien.zwart@gmail.com> Reported-by: Alex Lochmann <alexander.lochmann@tu-dortmund.de> Reported-by: Piotr Ko?aczkowski <pkolaczk@gmail.com> Reported-by: Clemens Eisserer <linuxhippy@gmail.com> Tested-by: Marien Zwart <marien.zwart@gmail.com> Tested-by: Doug Smythies <dsmythies@telus.net> [ rjw: Dropped pointless symbol definitions, rebased ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq/intel_pstate.c')
-rw-r--r--drivers/cpufreq/intel_pstate.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 2050796afd77..aef357203593 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -706,19 +706,20 @@ static void intel_pstate_get_min_max(struct cpudata *cpu, int *min, int *max)
706 *min = clamp_t(int, min_perf, cpu->pstate.min_pstate, max_perf); 706 *min = clamp_t(int, min_perf, cpu->pstate.min_pstate, max_perf);
707} 707}
708 708
709static void intel_pstate_set_pstate(struct cpudata *cpu, int pstate) 709static void intel_pstate_set_pstate(struct cpudata *cpu, int pstate, bool force)
710{ 710{
711 int max_perf, min_perf; 711 int max_perf, min_perf;
712 712
713 update_turbo_state(); 713 if (force) {
714 714 update_turbo_state();
715 intel_pstate_get_min_max(cpu, &min_perf, &max_perf);
716 715
717 pstate = clamp_t(int, pstate, min_perf, max_perf); 716 intel_pstate_get_min_max(cpu, &min_perf, &max_perf);
718 717
719 if (pstate == cpu->pstate.current_pstate) 718 pstate = clamp_t(int, pstate, min_perf, max_perf);
720 return;
721 719
720 if (pstate == cpu->pstate.current_pstate)
721 return;
722 }
722 trace_cpu_frequency(pstate * cpu->pstate.scaling, cpu->cpu); 723 trace_cpu_frequency(pstate * cpu->pstate.scaling, cpu->cpu);
723 724
724 cpu->pstate.current_pstate = pstate; 725 cpu->pstate.current_pstate = pstate;
@@ -735,7 +736,7 @@ static void intel_pstate_get_cpu_pstates(struct cpudata *cpu)
735 736
736 if (pstate_funcs.get_vid) 737 if (pstate_funcs.get_vid)
737 pstate_funcs.get_vid(cpu); 738 pstate_funcs.get_vid(cpu);
738 intel_pstate_set_pstate(cpu, cpu->pstate.min_pstate); 739 intel_pstate_set_pstate(cpu, cpu->pstate.min_pstate, false);
739} 740}
740 741
741static inline void intel_pstate_calc_busy(struct cpudata *cpu) 742static inline void intel_pstate_calc_busy(struct cpudata *cpu)
@@ -855,7 +856,7 @@ static inline void intel_pstate_adjust_busy_pstate(struct cpudata *cpu)
855 ctl = pid_calc(pid, busy_scaled); 856 ctl = pid_calc(pid, busy_scaled);
856 857
857 /* Negative values of ctl increase the pstate and vice versa */ 858 /* Negative values of ctl increase the pstate and vice versa */
858 intel_pstate_set_pstate(cpu, cpu->pstate.current_pstate - ctl); 859 intel_pstate_set_pstate(cpu, cpu->pstate.current_pstate - ctl, true);
859 860
860 sample = &cpu->sample; 861 sample = &cpu->sample;
861 trace_pstate_sample(fp_toint(sample->core_pct_busy), 862 trace_pstate_sample(fp_toint(sample->core_pct_busy),
@@ -1018,7 +1019,7 @@ static void intel_pstate_stop_cpu(struct cpufreq_policy *policy)
1018 if (hwp_active) 1019 if (hwp_active)
1019 return; 1020 return;
1020 1021
1021 intel_pstate_set_pstate(cpu, cpu->pstate.min_pstate); 1022 intel_pstate_set_pstate(cpu, cpu->pstate.min_pstate, false);
1022} 1023}
1023 1024
1024static int intel_pstate_cpu_init(struct cpufreq_policy *policy) 1025static int intel_pstate_cpu_init(struct cpufreq_policy *policy)