All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dirk Brandewie <dirk.brandewie@gmail.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Patrik Lundquist <patrik.lundquist@gmail.com>
Cc: dirk.brandewie@gmail.com,
	"cpufreq@vger.kernel.org" <cpufreq@vger.kernel.org>,
	Linux PM list <linux-pm@vger.kernel.org>
Subject: Re: [PATCH] cpufreq: Skip current frequency initialization for ->setpolicy drivers
Date: Wed, 12 Mar 2014 16:30:44 -0700	[thread overview]
Message-ID: <5320EE24.4030005@gmail.com> (raw)
In-Reply-To: <2460637.PSm5Ca8pqs@vostro.rjw.lan>

On 03/12/2014 04:30 PM, Rafael J. Wysocki wrote:
> Dirk, please let me know if you're fine with it.
>
> ---
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Subject: cpufreq: Skip current frequency initialization for ->setpolicy drivers
>
> After commit da60ce9f2fac (cpufreq: call cpufreq_driver->get() after
> calling ->init()) __cpufreq_add_dev() sometimes fails for CPUs handled
> by intel_pstate, because that driver may return 0 from its ->get()
> callback if it has not run long enough to collect enough samples on the
> given CPU.  That didn't happen before commit da60ce9f2fac which added
> policy->cur initialization to __cpufreq_add_dev() to help reduce code
> duplication in other cpufreq drivers.
>
> However, the code added by commit da60ce9f2fac need not be executed
> for cpufreq drivers having the ->setpolicy callback defined, because
> the subsequent invocation of cpufreq_set_policy() will use that
> callback to initialize the policy anyway and it doesn't need
> policy->cur to be initialized upfront.  The analogous code in
> cpufreq_update_policy() is also unnecessary for cpufreq drivers
> having ->setpolicy set and may be skipped for them as well.
>
> Since intel_pstate provides ->setpolicy, skipping the upfront
> policy->cur initialization for cpufreq drivers with that callback
> set will cover intel_pstate and the problem it's been having after
> commit da60ce9f2fac will be addressed.
>
> Fixes: da60ce9f2fac (cpufreq: call cpufreq_driver->get() after calling ->init())
> References: https://bugzilla.kernel.org/show_bug.cgi?id=71931
> Reported-and-tested-by: Patrik Lundquist <patrik.lundquist@gmail.com>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Acked-by: Dirk Brandewie <dirk.j.brandewie@intel.com>

> Cc: 3.13+ <stable@vger.kernel.org> # 3.13+
> ---
>   drivers/cpufreq/cpufreq.c |    4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> Index: linux-pm/drivers/cpufreq/cpufreq.c
> ===================================================================
> --- linux-pm.orig/drivers/cpufreq/cpufreq.c
> +++ linux-pm/drivers/cpufreq/cpufreq.c
> @@ -1129,7 +1129,7 @@ static int __cpufreq_add_dev(struct devi
>   		per_cpu(cpufreq_cpu_data, j) = policy;
>   	write_unlock_irqrestore(&cpufreq_driver_lock, flags);
>
> -	if (cpufreq_driver->get) {
> +	if (cpufreq_driver->get && !cpufreq_driver->setpolicy) {
>   		policy->cur = cpufreq_driver->get(policy->cpu);
>   		if (!policy->cur) {
>   			pr_err("%s: ->get() failed\n", __func__);
> @@ -2143,7 +2143,7 @@ int cpufreq_update_policy(unsigned int c
>   	 * BIOS might change freq behind our back
>   	 * -> ask driver for current freq and notify governors about a change
>   	 */
> -	if (cpufreq_driver->get) {
> +	if (cpufreq_driver->get && !cpufreq_driver->setpolicy) {
>   		new_policy.cur = cpufreq_driver->get(cpu);
>   		if (!policy->cur) {
>   			pr_debug("Driver did not initialize current freq");
>


  reply	other threads:[~2014-03-12 23:30 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-07 15:49 v3.13.5 intel_pstate: cpufreq: __cpufreq_add_dev: ->get() failed Patrik Lundquist
2014-03-10  5:23 ` Viresh Kumar
2014-03-10 12:15   ` Patrik Lundquist
2014-03-11 17:58 ` Dirk Brandewie
2014-03-11 19:50   ` Rafael J. Wysocki
2014-03-11 20:08     ` Dirk Brandewie
2014-03-11 20:45       ` Rafael J. Wysocki
2014-03-12  5:21       ` Viresh Kumar
2014-03-12 11:09         ` Rafael J. Wysocki
2014-03-11 20:20   ` Rafael J. Wysocki
2014-03-11 20:17     ` Dirk Brandewie
2014-03-11 20:52       ` Rafael J. Wysocki
2014-03-11 20:57         ` Rafael J. Wysocki
2014-03-11 20:55           ` Dirk Brandewie
2014-03-11 22:48             ` Rafael J. Wysocki
2014-03-11 23:07               ` Rafael J. Wysocki
2014-03-11 23:09                 ` Rafael J. Wysocki
2014-03-11 23:53                   ` Rafael J. Wysocki
2014-03-12  5:22                     ` Viresh Kumar
2014-03-12 11:42                 ` Patrik Lundquist
2014-03-12 13:27                   ` Rafael J. Wysocki
2014-03-12 14:14                   ` Patrik Lundquist
2014-03-12 23:30                     ` [PATCH] cpufreq: Skip current frequency initialization for ->setpolicy drivers Rafael J. Wysocki
2014-03-12 23:30                       ` Dirk Brandewie [this message]
2014-03-18 11:53                       ` Srivatsa S. Bhat
2014-03-12  5:25           ` v3.13.5 intel_pstate: cpufreq: __cpufreq_add_dev: ->get() failed Viresh Kumar
2014-03-12 11:03             ` Rafael J. Wysocki
2014-03-11 22:07   ` Patrik Lundquist

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=5320EE24.4030005@gmail.com \
    --to=dirk.brandewie@gmail.com \
    --cc=cpufreq@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=patrik.lundquist@gmail.com \
    --cc=rjw@rjwysocki.net \
    /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.