mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: linaro-kernel@lists.linaro.org, patches@linaro.org,
	cpufreq@vger.kernel.org, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org, robin.randhawa@arm.com,
	Steve.Bannister@arm.com, Liviu.Dudau@arm.com,
	charles.garcia-tobin@arm.com, arvind.chauhan@arm.com,
	broonie@linaro.org
Subject: Re: [PATCH] cpufreq: Fix serialization of frequency transitions
Date: Tue, 02 Jul 2013 13:37:33 +0200	[thread overview]
Message-ID: <7393749.6hgtTXF9VC@vostro.rjw.lan> (raw)
In-Reply-To: <d367fc6fda0f167678a83e1d70e0cfd240a32cbc.1372759022.git.viresh.kumar@linaro.org>

On Tuesday, July 02, 2013 04:36:28 PM Viresh Kumar wrote:
> Commit 7c30ed ("cpufreq: make sure frequency transitions are serialized")
> interacts poorly with systems that have a single core freqency for all
> cores.  On such systems we have a single policy for all cores with
> several CPUs.  When we do a frequency transition the governor calls the
> pre and post change notifiers which causes cpufreq_notify_transition()
> per CPU.  Since the policy is the same for all of them all CPUs after
> the first and the warnings added are generated by checking a per-policy
> flag the warnings will be triggered for all cores after the first.
> 
> Fix this by allowing notifier to be called for n times. Where n is the number of
> cpus in policy->cpus.
> 
> Reported-and-Tested-by: Mark Brown <broonie@linaro.org>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
> Hi Rafael,
> 
> This is a fix for 3.11.

Queued up for 3.11.

Thanks,
Rafael


>  drivers/cpufreq/cpufreq.c | 7 ++++---
>  include/linux/cpufreq.h   | 2 +-
>  2 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index b557503..b7bda8d 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -312,11 +312,12 @@ static void __cpufreq_notify_transition(struct cpufreq_policy *policy,
>  	switch (state) {
>  
>  	case CPUFREQ_PRECHANGE:
> -		if (WARN(policy->transition_ongoing,
> +		if (WARN(policy->transition_ongoing ==
> +					cpumask_weight(policy->cpus),
>  				"In middle of another frequency transition\n"))
>  			return;
>  
> -		policy->transition_ongoing = true;
> +		policy->transition_ongoing++;
>  
>  		/* detect if the driver reported a value as "old frequency"
>  		 * which is not equal to what the cpufreq core thinks is
> @@ -341,7 +342,7 @@ static void __cpufreq_notify_transition(struct cpufreq_policy *policy,
>  				"No frequency transition in progress\n"))
>  			return;
>  
> -		policy->transition_ongoing = false;
> +		policy->transition_ongoing--;
>  
>  		adjust_jiffies(CPUFREQ_POSTCHANGE, freqs);
>  		pr_debug("FREQ: %lu - CPU: %lu", (unsigned long)freqs->new,
> diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
> index 4d7390b..90d5a15 100644
> --- a/include/linux/cpufreq.h
> +++ b/include/linux/cpufreq.h
> @@ -119,7 +119,7 @@ struct cpufreq_policy {
>  
>  	struct kobject		kobj;
>  	struct completion	kobj_unregister;
> -	bool			transition_ongoing; /* Tracks transition status */
> +	int			transition_ongoing; /* Tracks transition status */
>  };
>  
>  #define CPUFREQ_ADJUST			(0)
> 
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

      reply	other threads:[~2013-07-02 11:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-02 11:06 Viresh Kumar
2013-07-02 11:37 ` Rafael J. Wysocki [this message]

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=7393749.6hgtTXF9VC@vostro.rjw.lan \
    --to=rjw@sisk.pl \
    --cc=Liviu.Dudau@arm.com \
    --cc=Steve.Bannister@arm.com \
    --cc=arvind.chauhan@arm.com \
    --cc=broonie@linaro.org \
    --cc=charles.garcia-tobin@arm.com \
    --cc=cpufreq@vger.kernel.org \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=patches@linaro.org \
    --cc=robin.randhawa@arm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®