diff mbox

cpfreq/intel_pstate: Fix max_perf_pct on resume

Message ID 1381860374-29681-1-git-send-email-dirk.j.brandewie@intel.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

dirk.brandewie@gmail.com Oct. 15, 2013, 6:06 p.m. UTC
From: Dirk Brandewie <dirk.j.brandewie@intel.com>

If the system is suspended while max_perf_pct is less than 100 percent
or no_turbo set policy->{min,max} will be set incorrectly with scaled
values which turn the scaled values into hard limits.

Fixes https://bugzilla.kernel.org/show_bug.cgi?id=61241

Reported-by: Patrick Bartels <petzicus@googlemail.com>
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
Cc: stable@vger.kernel.org
---
 drivers/cpufreq/intel_pstate.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Rafael J. Wysocki Oct. 16, 2013, 12:04 a.m. UTC | #1
On Tuesday, October 15, 2013 11:06:14 AM dirk.brandewie@gmail.com wrote:
> From: Dirk Brandewie <dirk.j.brandewie@intel.com>
> 
> If the system is suspended while max_perf_pct is less than 100 percent
> or no_turbo set policy->{min,max} will be set incorrectly with scaled
> values which turn the scaled values into hard limits.
> 
> Fixes https://bugzilla.kernel.org/show_bug.cgi?id=61241
> 
> Reported-by: Patrick Bartels <petzicus@googlemail.com>
> Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
> Cc: stable@vger.kernel.org

Applied, but I modified it to drop min_state and max_state too which are not
used any more.

Thanks!

> ---
>  drivers/cpufreq/intel_pstate.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
> index 32b3479..3335f55 100644
> --- a/drivers/cpufreq/intel_pstate.c
> +++ b/drivers/cpufreq/intel_pstate.c
> @@ -652,9 +652,8 @@ static int intel_pstate_cpu_init(struct cpufreq_policy *policy)
>  	else
>  		policy->policy = CPUFREQ_POLICY_POWERSAVE;
>  
> -	intel_pstate_get_min_max(cpu, &min_pstate, &max_pstate);
> -	policy->min = min_pstate * 100000;
> -	policy->max = max_pstate * 100000;
> +	policy->min = cpu->pstate.min_pstate * 100000;
> +	policy->max = cpu->pstate.turbo_pstate * 100000;
>  
>  	/* cpuinfo and default policy values */
>  	policy->cpuinfo.min_freq = cpu->pstate.min_pstate * 100000;
>
diff mbox

Patch

diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 32b3479..3335f55 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -652,9 +652,8 @@  static int intel_pstate_cpu_init(struct cpufreq_policy *policy)
 	else
 		policy->policy = CPUFREQ_POLICY_POWERSAVE;
 
-	intel_pstate_get_min_max(cpu, &min_pstate, &max_pstate);
-	policy->min = min_pstate * 100000;
-	policy->max = max_pstate * 100000;
+	policy->min = cpu->pstate.min_pstate * 100000;
+	policy->max = cpu->pstate.turbo_pstate * 100000;
 
 	/* cpuinfo and default policy values */
 	policy->cpuinfo.min_freq = cpu->pstate.min_pstate * 100000;