Re: [RFC PATCH 11/19] cpufreq: assert policy->rwsem is held in __cpufreq_governor
From: Viresh Kumar
Date: Tue Jan 12 2016 - 05:20:39 EST
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@xxxxxxxxxxxxx>
> Cc: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
> Signed-off-by: Juri Lelli <juri.lelli@xxxxxxx>
> ---
> 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