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


Groups > linux.kernel > #1322197

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

From Saravana Kannan <skannan@codeaurora.org>
Newsgroups linux.kernel
Subject Re: [RFC PATCH 11/19] cpufreq: assert policy->rwsem is held in __cpufreq_governor
Date 2016-01-30 01:40 +0100
Message-ID <qWrK2-2Ro-3@gated-at.bofh.it> (permalink)
References <qPOBH-5zs-9@gated-at.bofh.it> <qPOLo-5E8-5@gated-at.bofh.it> <qQ4n9-81P-29@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 01/12/2016 02:20 AM, Viresh Kumar wrote:
> 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")
>

AFAIR, the ABBA issue was between the sysfs lock and the policy lock. 
The fix for that issue should not be dropping the lock around 
POLICY_EXIT. The proper fix is to have the governor "export" the 
attributes it wants to add/remove and have the cpufreq framework do the 
adding/removing of the attributes from sysfs for the governor.

Thanks,
Saravana

-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: [RFC PATCH 11/19] cpufreq: assert policy->rwsem is held in __cpufreq_governor Saravana Kannan <skannan@codeaurora.org> - 2016-01-30 01:40 +0100
  Re: [RFC PATCH 11/19] cpufreq: assert policy->rwsem is held in __cpufreq_governor "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-01-30 12:50 +0100
    Re: [RFC PATCH 11/19] cpufreq: assert policy->rwsem is held in  __cpufreq_governor Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-01 07:20 +0100
      Re: [RFC PATCH 11/19] cpufreq: assert policy->rwsem is held in __cpufreq_governor "Rafael J. Wysocki" <rafael@kernel.org> - 2016-02-01 11:30 +0100
        Re: [RFC PATCH 11/19] cpufreq: assert policy->rwsem is held in __cpufreq_governor Saravana Kannan <skannan@codeaurora.org> - 2016-02-01 21:30 +0100
          Re: [RFC PATCH 11/19] cpufreq: assert policy->rwsem is held in __cpufreq_governor "Rafael J. Wysocki" <rafael@kernel.org> - 2016-02-01 22:10 +0100
            Re: [RFC PATCH 11/19] cpufreq: assert policy->rwsem is held in  __cpufreq_governor Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-02 07:40 +0100
              Re: [RFC PATCH 11/19] cpufreq: assert policy->rwsem is held in __cpufreq_governor Saravana Kannan <skannan@codeaurora.org> - 2016-02-02 22:40 +0100
          Re: [RFC PATCH 11/19] cpufreq: assert policy->rwsem is held in  __cpufreq_governor Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-02 07:40 +0100
            Re: [RFC PATCH 11/19] cpufreq: assert policy->rwsem is held in __cpufreq_governor Saravana Kannan <skannan@codeaurora.org> - 2016-02-02 22:40 +0100
              Re: [RFC PATCH 11/19] cpufreq: assert policy->rwsem is held in  __cpufreq_governor Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-03 03:20 +0100
                Re: [RFC PATCH 11/19] cpufreq: assert policy->rwsem is held in __cpufreq_governor Saravana Kannan <skannan@codeaurora.org> - 2016-02-03 05:10 +0100
                Re: [RFC PATCH 11/19] cpufreq: assert policy->rwsem is held in __cpufreq_governor Saravana Kannan <skannan@codeaurora.org> - 2016-02-03 06:10 +0100
                Re: [RFC PATCH 11/19] cpufreq: assert policy->rwsem is held in  __cpufreq_governor Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-03 08:00 +0100
                Re: [RFC PATCH 11/19] cpufreq: assert policy->rwsem is held in  __cpufreq_governor Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-03 06:10 +0100

csiph-web