Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1306561 > unrolled thread

[RFC PATCH 11/19] cpufreq: assert policy->rwsem is held in __cpufreq_governor

Started byJuri Lelli <juri.lelli@arm.com>
First post2016-01-11 18:50 +0100
Last post2016-01-12 11:30 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [RFC PATCH 11/19] cpufreq: assert policy->rwsem is held in __cpufreq_governor Juri Lelli <juri.lelli@arm.com> - 2016-01-11 18:50 +0100
    Re: [RFC PATCH 11/19] cpufreq: assert policy->rwsem is held in  __cpufreq_governor Viresh Kumar <viresh.kumar@linaro.org> - 2016-01-12 11:30 +0100

#1306561 — [RFC PATCH 11/19] cpufreq: assert policy->rwsem is held in __cpufreq_governor

FromJuri Lelli <juri.lelli@arm.com>
Date2016-01-11 18:50 +0100
Subject[RFC PATCH 11/19] cpufreq: assert policy->rwsem is held in __cpufreq_governor
Message-ID<qPOLo-5E8-5@gated-at.bofh.it>
__cpufreq_governor works on policy, so policy->rwsem has to be held.
Add assertion for such condition.

Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Juri Lelli <juri.lelli@arm.com>
---
 drivers/cpufreq/cpufreq.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index f1f9fbc..e7fc5c9 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1950,6 +1950,9 @@ static int __cpufreq_governor(struct cpufreq_policy *policy,
 	/* Don't start any governor operations if we are entering suspend */
 	if (cpufreq_suspended)
 		return 0;
+
+	lockdep_assert_held(&policy->rwsem);
+
 	/*
 	 * Governor might not be initiated here if ACPI _PPC changed
 	 * notification happened, so check it.
-- 
2.2.2

[toc] | [next] | [standalone]


#1307229 — Re: [RFC PATCH 11/19] cpufreq: assert policy->rwsem is held in __cpufreq_governor

FromViresh Kumar <viresh.kumar@linaro.org>
Date2016-01-12 11:30 +0100
SubjectRe: [RFC PATCH 11/19] cpufreq: assert policy->rwsem is held in __cpufreq_governor
Message-ID<qQ4n9-81P-29@gated-at.bofh.it>
In reply to#1306561
On 11-01-16, 17:35, Juri Lelli wrote:
> __cpufreq_governor works on policy, so policy->rwsem has to be held.
> Add assertion for such condition.
> 
> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> Cc: Viresh Kumar <viresh.kumar@linaro.org>
> Signed-off-by: Juri Lelli <juri.lelli@arm.com>
> ---
>  drivers/cpufreq/cpufreq.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index f1f9fbc..e7fc5c9 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -1950,6 +1950,9 @@ static int __cpufreq_governor(struct cpufreq_policy *policy,
>  	/* Don't start any governor operations if we are entering suspend */
>  	if (cpufreq_suspended)
>  		return 0;
> +
> +	lockdep_assert_held(&policy->rwsem);
> +

We had an ABBA problem with the EXIT governor callback and so this
rwsem is dropped just before that from set_policy()..

commit 955ef4833574 ("cpufreq: Drop rwsem lock around
CPUFREQ_GOV_POLICY_EXIT")

-- 
viresh

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web