All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cpufreq: update 'cpufreq_suspended' after stopping governors
@ 2014-09-30  4:03 Viresh Kumar
  2014-09-30 20:19 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Viresh Kumar @ 2014-09-30  4:03 UTC (permalink / raw)
  To: Rafael Wysocki, tianyu.lan
  Cc: linaro-kernel, linux-pm, linux-kernel, Viresh Kumar, 3.15+

Commit 8e30444e1530 ("cpufreq: fix cpufreq suspend/resume for intel_pstate")
introduced a bug where the governors wouldn't be stopped anymore for
->target{_index}() drivers during suspend. This happens because
'cpufreq_suspended' is updated before stopping the governors during suspend and
due to this __cpufreq_governor() would return early due to this check:

	/* Don't start any governor operations if we are entering suspend */
	if (cpufreq_suspended)
		return 0;

This patch tries to fix this bug.

Fixes: 8e30444e1530 ("cpufreq: fix cpufreq suspend/resume for intel_pstate")
Cc: 3.15+ <stable@vger.kernel.org> # 3.15+
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/cpufreq/cpufreq.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 6e93e7f..61190f6 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1658,10 +1658,8 @@ void cpufreq_suspend(void)
 	if (!cpufreq_driver)
 		return;
 
-	cpufreq_suspended = true;
-
 	if (!has_target())
-		return;
+		goto suspend;
 
 	pr_debug("%s: Suspending Governors\n", __func__);
 
@@ -1674,6 +1672,9 @@ void cpufreq_suspend(void)
 			pr_err("%s: Failed to suspend driver: %p\n", __func__,
 				policy);
 	}
+
+suspend:
+	cpufreq_suspended = true;
 }
 
 /**
-- 
2.0.3.693.g996b0fd


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cpufreq: update 'cpufreq_suspended' after stopping governors
  2014-09-30  4:03 [PATCH] cpufreq: update 'cpufreq_suspended' after stopping governors Viresh Kumar
@ 2014-09-30 20:19 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2014-09-30 20:19 UTC (permalink / raw)
  To: Viresh Kumar; +Cc: tianyu.lan, linaro-kernel, linux-pm, linux-kernel, 3.15+

On Tuesday, September 30, 2014 09:33:17 AM Viresh Kumar wrote:
> Commit 8e30444e1530 ("cpufreq: fix cpufreq suspend/resume for intel_pstate")
> introduced a bug where the governors wouldn't be stopped anymore for
> ->target{_index}() drivers during suspend. This happens because
> 'cpufreq_suspended' is updated before stopping the governors during suspend and
> due to this __cpufreq_governor() would return early due to this check:
> 
> 	/* Don't start any governor operations if we are entering suspend */
> 	if (cpufreq_suspended)
> 		return 0;
> 
> This patch tries to fix this bug.
> 
> Fixes: 8e30444e1530 ("cpufreq: fix cpufreq suspend/resume for intel_pstate")
> Cc: 3.15+ <stable@vger.kernel.org> # 3.15+
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

Queued up for 3.17, thanks!

> ---
>  drivers/cpufreq/cpufreq.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 6e93e7f..61190f6 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -1658,10 +1658,8 @@ void cpufreq_suspend(void)
>  	if (!cpufreq_driver)
>  		return;
>  
> -	cpufreq_suspended = true;
> -
>  	if (!has_target())
> -		return;
> +		goto suspend;
>  
>  	pr_debug("%s: Suspending Governors\n", __func__);
>  
> @@ -1674,6 +1672,9 @@ void cpufreq_suspend(void)
>  			pr_err("%s: Failed to suspend driver: %p\n", __func__,
>  				policy);
>  	}
> +
> +suspend:
> +	cpufreq_suspended = true;
>  }
>  
>  /**
> 

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-09-30 19:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-30  4:03 [PATCH] cpufreq: update 'cpufreq_suspended' after stopping governors Viresh Kumar
2014-09-30 20:19 ` Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.