Linux Power Management development
 help / color / mirror / Atom feed
* [PATCH] Cpufreq: Acquire read lock in the cpufreq_policy_restore() rather than write lock
@ 2013-09-11  7:05 tianyu.lan
  2013-09-11  8:09 ` Srivatsa S. Bhat
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: tianyu.lan @ 2013-09-11  7:05 UTC (permalink / raw)
  To: rjw, viresh.kumar, srivatsa.bhat
  Cc: Lan Tianyu, cpufreq, linux-pm, linux-kernel

From: Lan Tianyu <tianyu.lan@intel.com>

In the cpufreq_policy_restore(), policy before system suspend is read from
from percpu's cpufreq_cpu_data_fallback. It's read operation rather than
write operation. So convert write lock to read lock

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

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 81ceea6..b762f9b 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -912,11 +912,11 @@ static struct cpufreq_policy *cpufreq_policy_restore(unsigned int cpu)
 	struct cpufreq_policy *policy;
 	unsigned long flags;
 
-	write_lock_irqsave(&cpufreq_driver_lock, flags);
+	read_lock_irqsave(&cpufreq_driver_lock, flags);
 
 	policy = per_cpu(cpufreq_cpu_data_fallback, cpu);
 
-	write_unlock_irqrestore(&cpufreq_driver_lock, flags);
+	read_unlock_irqrestore(&cpufreq_driver_lock, flags);
 
 	return policy;
 }
-- 
1.8.4.rc0.1.g8f6a3e5.dirty


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

* Re: [PATCH] Cpufreq: Acquire read lock in the cpufreq_policy_restore() rather than write lock
  2013-09-11  7:05 [PATCH] Cpufreq: Acquire read lock in the cpufreq_policy_restore() rather than write lock tianyu.lan
@ 2013-09-11  8:09 ` Srivatsa S. Bhat
  2013-09-11  8:44 ` Viresh Kumar
  2013-09-11 22:56 ` Rafael J. Wysocki
  2 siblings, 0 replies; 4+ messages in thread
From: Srivatsa S. Bhat @ 2013-09-11  8:09 UTC (permalink / raw)
  To: tianyu.lan; +Cc: rjw, viresh.kumar, cpufreq, linux-pm, linux-kernel

On 09/11/2013 12:35 PM, tianyu.lan@intel.com wrote:
> From: Lan Tianyu <tianyu.lan@intel.com>
> 
> In the cpufreq_policy_restore(), policy before system suspend is read from
> from percpu's cpufreq_cpu_data_fallback. It's read operation rather than
> write operation. So convert write lock to read lock
> 
> Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>

Reviewed-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>

I noticed it too yesterday, while looking at something else. Thanks for
fixing this!

> ---
>  drivers/cpufreq/cpufreq.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 81ceea6..b762f9b 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -912,11 +912,11 @@ static struct cpufreq_policy *cpufreq_policy_restore(unsigned int cpu)
>  	struct cpufreq_policy *policy;
>  	unsigned long flags;
> 
> -	write_lock_irqsave(&cpufreq_driver_lock, flags);
> +	read_lock_irqsave(&cpufreq_driver_lock, flags);
> 
>  	policy = per_cpu(cpufreq_cpu_data_fallback, cpu);
> 
> -	write_unlock_irqrestore(&cpufreq_driver_lock, flags);
> +	read_unlock_irqrestore(&cpufreq_driver_lock, flags);
> 
>  	return policy;
>  }
> 
 
Regards,
Srivatsa S. Bhat


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

* Re: [PATCH] Cpufreq: Acquire read lock in the cpufreq_policy_restore() rather than write lock
  2013-09-11  7:05 [PATCH] Cpufreq: Acquire read lock in the cpufreq_policy_restore() rather than write lock tianyu.lan
  2013-09-11  8:09 ` Srivatsa S. Bhat
@ 2013-09-11  8:44 ` Viresh Kumar
  2013-09-11 22:56 ` Rafael J. Wysocki
  2 siblings, 0 replies; 4+ messages in thread
From: Viresh Kumar @ 2013-09-11  8:44 UTC (permalink / raw)
  To: Lan Tianyu
  Cc: Rafael J. Wysocki, Srivatsa S. Bhat, cpufreq@vger.kernel.org,
	linux-pm@vger.kernel.org, Linux Kernel Mailing List

On 11 September 2013 12:35,  <tianyu.lan@intel.com> wrote:
> From: Lan Tianyu <tianyu.lan@intel.com>
>
> In the cpufreq_policy_restore(), policy before system suspend is read from
> from percpu's cpufreq_cpu_data_fallback. It's read operation rather than
> write operation. So convert write lock to read lock
>
> Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
> ---
>  drivers/cpufreq/cpufreq.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 81ceea6..b762f9b 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -912,11 +912,11 @@ static struct cpufreq_policy *cpufreq_policy_restore(unsigned int cpu)
>         struct cpufreq_policy *policy;
>         unsigned long flags;
>
> -       write_lock_irqsave(&cpufreq_driver_lock, flags);
> +       read_lock_irqsave(&cpufreq_driver_lock, flags);
>
>         policy = per_cpu(cpufreq_cpu_data_fallback, cpu);
>
> -       write_unlock_irqrestore(&cpufreq_driver_lock, flags);
> +       read_unlock_irqrestore(&cpufreq_driver_lock, flags);
>
>         return policy;
>  }

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

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

* Re: [PATCH] Cpufreq: Acquire read lock in the cpufreq_policy_restore() rather than write lock
  2013-09-11  7:05 [PATCH] Cpufreq: Acquire read lock in the cpufreq_policy_restore() rather than write lock tianyu.lan
  2013-09-11  8:09 ` Srivatsa S. Bhat
  2013-09-11  8:44 ` Viresh Kumar
@ 2013-09-11 22:56 ` Rafael J. Wysocki
  2 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2013-09-11 22:56 UTC (permalink / raw)
  To: tianyu.lan; +Cc: viresh.kumar, srivatsa.bhat, cpufreq, linux-pm, linux-kernel

On Wednesday, September 11, 2013 03:05:05 PM tianyu.lan@intel.com wrote:
> From: Lan Tianyu <tianyu.lan@intel.com>
> 
> In the cpufreq_policy_restore(), policy before system suspend is read from
> from percpu's cpufreq_cpu_data_fallback. It's read operation rather than
> write operation. So convert write lock to read lock
> 
> Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>

Applied, thanks Tianyu!

> ---
>  drivers/cpufreq/cpufreq.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 81ceea6..b762f9b 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -912,11 +912,11 @@ static struct cpufreq_policy *cpufreq_policy_restore(unsigned int cpu)
>  	struct cpufreq_policy *policy;
>  	unsigned long flags;
>  
> -	write_lock_irqsave(&cpufreq_driver_lock, flags);
> +	read_lock_irqsave(&cpufreq_driver_lock, flags);
>  
>  	policy = per_cpu(cpufreq_cpu_data_fallback, cpu);
>  
> -	write_unlock_irqrestore(&cpufreq_driver_lock, flags);
> +	read_unlock_irqrestore(&cpufreq_driver_lock, flags);
>  
>  	return policy;
>  }
> 
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

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

end of thread, other threads:[~2013-09-11 22:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-11  7:05 [PATCH] Cpufreq: Acquire read lock in the cpufreq_policy_restore() rather than write lock tianyu.lan
2013-09-11  8:09 ` Srivatsa S. Bhat
2013-09-11  8:44 ` Viresh Kumar
2013-09-11 22:56 ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox