All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] Cpufreq: Keep cpufreq sysfs nodes across S2RAM/S2DISK when using intel_pstate driver.
@ 2014-09-18  7:03 Lan Tianyu
  2014-09-22 14:07 ` Rafael J. Wysocki
  2014-09-29  8:20 ` Viresh Kumar
  0 siblings, 2 replies; 5+ messages in thread
From: Lan Tianyu @ 2014-09-18  7:03 UTC (permalink / raw)
  To: rjw, viresh.kumar; +Cc: Lan Tianyu, linux-pm, linux-kernel

Cpufreq core introduces cpufreq_suspended flag to let cpufreq sysfs nodes
across S2RAM/S2DISK. But the flag is only set in the cpufreq_suspend()
for cpufreq drivers which have target or target_index callback. This
skips intel_pstate driver. This patch is to set the flag before checking
target or target_index callback.

Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
---
 drivers/cpufreq/cpufreq.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index d9fdedd..eb9bb78 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1656,6 +1656,8 @@ void cpufreq_suspend(void)
 	if (!cpufreq_driver)
 		return;
 
+	cpufreq_suspended = true;
+
 	if (!has_target())
 		return;
 
@@ -1670,8 +1672,6 @@ void cpufreq_suspend(void)
 			pr_err("%s: Failed to suspend driver: %p\n", __func__,
 				policy);
 	}
-
-	cpufreq_suspended = true;
 }
 
 /**
@@ -1687,13 +1687,13 @@ void cpufreq_resume(void)
 	if (!cpufreq_driver)
 		return;
 
+	cpufreq_suspended = false;
+
 	if (!has_target())
 		return;
 
 	pr_debug("%s: Resuming Governors\n", __func__);
 
-	cpufreq_suspended = false;
-
 	list_for_each_entry(policy, &cpufreq_policy_list, policy_list) {
 		if (cpufreq_driver->resume && cpufreq_driver->resume(policy))
 			pr_err("%s: Failed to resume driver: %p\n", __func__,
-- 
1.8.4.rc0.1.g8f6a3e5.dirty


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

* Re: [PATCH 1/1] Cpufreq: Keep cpufreq sysfs nodes across S2RAM/S2DISK when using intel_pstate driver.
  2014-09-18  7:03 [PATCH 1/1] Cpufreq: Keep cpufreq sysfs nodes across S2RAM/S2DISK when using intel_pstate driver Lan Tianyu
@ 2014-09-22 14:07 ` Rafael J. Wysocki
  2014-09-29  8:20 ` Viresh Kumar
  1 sibling, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2014-09-22 14:07 UTC (permalink / raw)
  To: Lan Tianyu, viresh.kumar, 'Dirk Brandewie'
  Cc: linux-pm, linux-kernel, 'Dirk Brandewie'

On Thursday, September 18, 2014 03:03:07 PM Lan Tianyu wrote:
> Cpufreq core introduces cpufreq_suspended flag to let cpufreq sysfs nodes
> across S2RAM/S2DISK. But the flag is only set in the cpufreq_suspend()
> for cpufreq drivers which have target or target_index callback. This
> skips intel_pstate driver. This patch is to set the flag before checking
> target or target_index callback.
> 
> Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>

Viresh, Dirk, this looks like a fix that should go into 3.17, so I'm
queuing it up accordingly.  Please let me know if that's not correct.

> ---
>  drivers/cpufreq/cpufreq.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index d9fdedd..eb9bb78 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -1656,6 +1656,8 @@ void cpufreq_suspend(void)
>  	if (!cpufreq_driver)
>  		return;
>  
> +	cpufreq_suspended = true;
> +
>  	if (!has_target())
>  		return;
>  
> @@ -1670,8 +1672,6 @@ void cpufreq_suspend(void)
>  			pr_err("%s: Failed to suspend driver: %p\n", __func__,
>  				policy);
>  	}
> -
> -	cpufreq_suspended = true;
>  }
>  
>  /**
> @@ -1687,13 +1687,13 @@ void cpufreq_resume(void)
>  	if (!cpufreq_driver)
>  		return;
>  
> +	cpufreq_suspended = false;
> +
>  	if (!has_target())
>  		return;
>  
>  	pr_debug("%s: Resuming Governors\n", __func__);
>  
> -	cpufreq_suspended = false;
> -
>  	list_for_each_entry(policy, &cpufreq_policy_list, policy_list) {
>  		if (cpufreq_driver->resume && cpufreq_driver->resume(policy))
>  			pr_err("%s: Failed to resume driver: %p\n", __func__,
> 

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

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

* Re: [PATCH 1/1] Cpufreq: Keep cpufreq sysfs nodes across S2RAM/S2DISK when using intel_pstate driver.
  2014-09-18  7:03 [PATCH 1/1] Cpufreq: Keep cpufreq sysfs nodes across S2RAM/S2DISK when using intel_pstate driver Lan Tianyu
  2014-09-22 14:07 ` Rafael J. Wysocki
@ 2014-09-29  8:20 ` Viresh Kumar
  2014-09-29 23:44   ` Rafael J. Wysocki
  2014-10-08  6:48   ` Lan Tianyu
  1 sibling, 2 replies; 5+ messages in thread
From: Viresh Kumar @ 2014-09-29  8:20 UTC (permalink / raw)
  To: Lan Tianyu
  Cc: Rafael J. Wysocki, linux-pm, Linux Kernel Mailing List, Dirk Brandewie

Sorry for being late on this. Was away for a week for Linaro Connect followed
by a week of vacations :(

On 18 September 2014 00:03, Lan Tianyu <tianyu.lan@intel.com> wrote:
> Cpufreq core introduces cpufreq_suspended flag to let cpufreq sysfs nodes
> across S2RAM/S2DISK. But the flag is only set in the cpufreq_suspend()
> for cpufreq drivers which have target or target_index callback. This
> skips intel_pstate driver. This patch is to set the flag before checking
> target or target_index callback.

Oh yes, this looks to be the right thing to do..

> Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
> ---
>  drivers/cpufreq/cpufreq.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index d9fdedd..eb9bb78 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -1656,6 +1656,8 @@ void cpufreq_suspend(void)
>         if (!cpufreq_driver)
>                 return;
>
> +       cpufreq_suspended = true;
> +
>         if (!has_target())
>                 return;
>
> @@ -1670,8 +1672,6 @@ void cpufreq_suspend(void)
>                         pr_err("%s: Failed to suspend driver: %p\n", __func__,
>                                 policy);
>         }
> -
> -       cpufreq_suspended = true;

But this change is buggy.. Because you are updating 'cpufreq_suspended'
before actually stopping the governor, any calls to __cpufreq_governor()
will be converted to NO-operations because of this in __cpufreq_governor():

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

And so the governor's will never stop :(

So you need to keep the above line where it was :)

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

* Re: [PATCH 1/1] Cpufreq: Keep cpufreq sysfs nodes across S2RAM/S2DISK when using intel_pstate driver.
  2014-09-29  8:20 ` Viresh Kumar
@ 2014-09-29 23:44   ` Rafael J. Wysocki
  2014-10-08  6:48   ` Lan Tianyu
  1 sibling, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2014-09-29 23:44 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Lan Tianyu, linux-pm, Linux Kernel Mailing List, Dirk Brandewie

On Monday, September 29, 2014 01:20:44 AM Viresh Kumar wrote:
> Sorry for being late on this. Was away for a week for Linaro Connect followed
> by a week of vacations :(
> 
> On 18 September 2014 00:03, Lan Tianyu <tianyu.lan@intel.com> wrote:
> > Cpufreq core introduces cpufreq_suspended flag to let cpufreq sysfs nodes
> > across S2RAM/S2DISK. But the flag is only set in the cpufreq_suspend()
> > for cpufreq drivers which have target or target_index callback. This
> > skips intel_pstate driver. This patch is to set the flag before checking
> > target or target_index callback.
> 
> Oh yes, this looks to be the right thing to do..
> 
> > Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
> > ---
> >  drivers/cpufreq/cpufreq.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> > index d9fdedd..eb9bb78 100644
> > --- a/drivers/cpufreq/cpufreq.c
> > +++ b/drivers/cpufreq/cpufreq.c
> > @@ -1656,6 +1656,8 @@ void cpufreq_suspend(void)
> >         if (!cpufreq_driver)
> >                 return;
> >
> > +       cpufreq_suspended = true;
> > +
> >         if (!has_target())
> >                 return;
> >
> > @@ -1670,8 +1672,6 @@ void cpufreq_suspend(void)
> >                         pr_err("%s: Failed to suspend driver: %p\n", __func__,
> >                                 policy);
> >         }
> > -
> > -       cpufreq_suspended = true;
> 
> But this change is buggy.. Because you are updating 'cpufreq_suspended'
> before actually stopping the governor, any calls to __cpufreq_governor()
> will be converted to NO-operations because of this in __cpufreq_governor():
> 
> /* Don't start any governor operations if we are entering suspend */
> if (cpufreq_suspended)
>     return 0;
> 
> And so the governor's will never stop :(
> 
> So you need to keep the above line where it was :)

OK, so please send a fix for that against the Linus' tree.

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

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

* Re: [PATCH 1/1] Cpufreq: Keep cpufreq sysfs nodes across S2RAM/S2DISK when using intel_pstate driver.
  2014-09-29  8:20 ` Viresh Kumar
  2014-09-29 23:44   ` Rafael J. Wysocki
@ 2014-10-08  6:48   ` Lan Tianyu
  1 sibling, 0 replies; 5+ messages in thread
From: Lan Tianyu @ 2014-10-08  6:48 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Rafael J. Wysocki, linux-pm, Linux Kernel Mailing List, Dirk Brandewie

Sorry later response and just back from vacation.

On 2014年09月29日 16:20, Viresh Kumar wrote:
> But this change is buggy.. Because you are updating 'cpufreq_suspended'
> before actually stopping the governor, any calls to __cpufreq_governor()
> will be converted to NO-operations because of this in __cpufreq_governor():
> 
> /* Don't start any governor operations if we are entering suspend */
> if (cpufreq_suspended)
>     return 0;
> 
> And so the governor's will never stop :(
> 
> So you need to keep the above line where it was :)
> 

Yes, you are right. Thanks for fixing it.
-- 
Best regards
Tianyu Lan

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

end of thread, other threads:[~2014-10-08  6:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-18  7:03 [PATCH 1/1] Cpufreq: Keep cpufreq sysfs nodes across S2RAM/S2DISK when using intel_pstate driver Lan Tianyu
2014-09-22 14:07 ` Rafael J. Wysocki
2014-09-29  8:20 ` Viresh Kumar
2014-09-29 23:44   ` Rafael J. Wysocki
2014-10-08  6:48   ` Lan Tianyu

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.