All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
Cc: Pierre Ossman <pierre-list@ossman.eu>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Linux PM mailing list <linux-pm@vger.kernel.org>
Subject: Re: [PATCH] cpufreq: fix current freq check on policy update
Date: Fri, 14 Feb 2014 14:58:43 +0100	[thread overview]
Message-ID: <1799893.BgHaHWcxf3@vostro.rjw.lan> (raw)
In-Reply-To: <52FE01A2.9030905@linux.vnet.ibm.com>

On Friday, February 14, 2014 05:14:34 PM Srivatsa S. Bhat wrote:
> On 02/14/2014 11:56 AM, Pierre Ossman wrote:
> > From de497de3fcd81e8340498cd0b34b3388fe75cc19 Mon Sep 17 00:00:00 2001
> > From: Pierre Ossman <pierre@ossman.eu>
> > Date: Fri, 14 Feb 2014 07:17:02 +0100
> > Subject: [PATCH] cpufreq: fix current freq check on policy update
> > 
> > There was some variable confusion in cpufreq_update_policy()
> > when we tried to get a current reading of the CPU frequency.
> > If it failed to get the frequency, a current frequency of
> > 0 kHz would be stored which in turn screwed up other parts
> > of the kernel.
> > 
> 
> You know what's interesting? I went through the powernow-k8 cpufreq
> driver code (based on your system data in the bugzilla), and found
> that (if I read it correctly), ->get() can simply never return 0 !
> 
> .get is mapped to powernowk8_get
> 
> powernowk8_get() in turn calls smp_call_function_single() on that cpu
> and fetches the data into data->currfid.
> 
> Then we have this statement:
> 	khz = find_khz_freq_from_fid(data->currfid);
> 
> which is:
> 
>   66 /* Return a frequency in MHz, given an input fid */
>   67 static u32 find_freq_from_fid(u32 fid)
>   68 {
>   69         return 800 + (fid * 100);
>   70 }
>   71 
>   72 /* Return a frequency in KHz, given an input fid */
>   73 static u32 find_khz_freq_from_fid(u32 fid)
>   74 {
>   75         return 1000 * find_freq_from_fid(fid);
>   76 }
> 
> 
> So with that, I don't see how the KHz value can turn out to be zero!

Due to a race condition of some sort?

Rafael


  reply	other threads:[~2014-02-14 13:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-14  6:26 [PATCH] cpufreq: fix current freq check on policy update Pierre Ossman
2014-02-14 11:44 ` Srivatsa S. Bhat
2014-02-14 13:58   ` Rafael J. Wysocki [this message]
2014-02-14 14:34   ` Pierre Ossman
2014-02-17  5:06     ` Viresh Kumar
2014-02-17  8:08     ` Srivatsa S. Bhat
2014-02-17  8:23       ` Viresh Kumar
2014-02-17  8:21         ` 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=1799893.BgHaHWcxf3@vostro.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=linux-pm@vger.kernel.org \
    --cc=pierre-list@ossman.eu \
    --cc=srivatsa.bhat@linux.vnet.ibm.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.