From: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Linus Walleij <linus.walleij@linaro.org>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: Regression on cpufreq in v3.12-rc1
Date: Fri, 20 Sep 2013 20:46:21 +0530 [thread overview]
Message-ID: <523C66C5.9040008@linux.vnet.ibm.com> (raw)
In-Reply-To: <CAKohpomXsZ+BsE7j-J4qU+x9f+JPsNEMi3d=CmfMByzPw_wvtw@mail.gmail.com>
On 09/20/2013 03:05 PM, Viresh Kumar wrote:
> On 20 September 2013 14:19, Viresh Kumar <viresh.kumar@linaro.org> wrote:
>> Hmm... Remember I told you last time that I have another way of fixing
>> it up, probably we need that now..
>>
>> I wanted to add another variable to reflect if a cpufreq_driver is registered
>> or not, and if not then return early from these routines..
>>
>> I will get that in now, please see if you can give it a try..
>>
>> But I am still surprised how are we reaching this place before your cpufreq
>> driver gets registered..
>
> Once we know what's going on in your system, please test attached patch
> (Will send it separately once you have tested it):
>
> commit 389fbc3c8ad7c339cd2d9572d73c355b7b967823
> Author: Viresh Kumar <viresh.kumar@linaro.org>
> Date: Fri Sep 20 14:55:31 2013 +0530
>
> cpufreq: check cpufreq driver is valid and cpufreq isn't disabled
> in cpufreq_get()
>
> cpufreq_get() can be called from external drivers which might not
> be aware if
> cpufreq driver is registered or not. And so we should actually
> check if cpufreq
> driver is registered or not and also if cpufreq is active or
> disabled, at the
> beginning of cpufreq_get().
>
> Otherwise call to lock_policy_rwsem_read() might hit BUG_ON(!policy).
>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
The patch looks reasonable to me. Earlier cpufreq_cpu_get() used to do the
necessary checks, but commit 6eed9404 removed the call to that function in
cpufreq_get(). So adding those checks back seem like the right fix to me.
Also, looking at commit 6eed9404, I think show() and store() also suffer
from a similar fate. So do you think we need to add these checks there as well?
I'm not sure, since I can't think of a situation in which show() or store()
can be invoked before the cpufreq-driver is registered.. or, is such a
situation possible with cpufreq_disabled()?
Regards,
Srivatsa S. Bhat
> ---
> drivers/cpufreq/cpufreq.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 82ecbe3..db004a8 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -1460,6 +1460,9 @@ unsigned int cpufreq_get(unsigned int cpu)
> {
> unsigned int ret_freq = 0;
>
> + if (cpufreq_disabled() || !cpufreq_driver)
> + return -ENOENT;
> +
> if (!down_read_trylock(&cpufreq_rwsem))
> return 0;
>
next prev parent reply other threads:[~2013-09-20 15:20 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-18 21:21 Regression on cpufreq in v3.12-rc1 Linus Walleij
2013-09-18 22:41 ` Rafael J. Wysocki
2013-09-19 12:21 ` Linus Walleij
2013-09-19 12:46 ` Srivatsa S. Bhat
2013-09-19 12:55 ` Linus Walleij
2013-09-19 12:58 ` Srivatsa S. Bhat
2013-09-19 14:12 ` Viresh Kumar
2013-09-19 18:11 ` Srivatsa S. Bhat
2013-09-19 18:17 ` Srivatsa S. Bhat
2013-09-20 4:19 ` Viresh Kumar
2013-09-20 10:13 ` Srivatsa S. Bhat
2013-09-20 8:43 ` Linus Walleij
2013-09-20 8:33 ` Linus Walleij
2013-09-20 8:39 ` Viresh Kumar
2013-09-20 8:41 ` Linus Walleij
2013-09-20 8:49 ` Viresh Kumar
2013-09-20 9:35 ` Viresh Kumar
2013-09-20 15:16 ` Srivatsa S. Bhat [this message]
2013-09-20 16:54 ` Viresh Kumar
2013-09-21 5:47 ` Srivatsa S. Bhat
2013-09-20 15:36 ` Linus Walleij
2013-09-20 15:39 ` Linus Walleij
2013-09-20 17:05 ` Viresh Kumar
2013-09-20 17:31 ` Linus Walleij
2013-09-20 15:21 ` Linus Walleij
2013-09-20 15:32 ` Srivatsa S. Bhat
2013-09-20 15:40 ` Linus Walleij
2013-09-20 16:34 ` Linus Walleij
2013-09-20 17:01 ` Viresh Kumar
2013-09-21 5:48 ` Srivatsa S. Bhat
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=523C66C5.9040008@linux.vnet.ibm.com \
--to=srivatsa.bhat@linux.vnet.ibm.com \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox