mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: skannan@codeaurora.org, linaro-kernel@lists.linaro.org,
	cpufreq@vger.kernel.org, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org, srivatsa.bhat@linux.vnet.ibm.com
Subject: Re: [PATCH 2/3] cpufreq: Initialize policy before making it available for others to use
Date: Sat, 01 Mar 2014 02:14:35 +0100	[thread overview]
Message-ID: <278741659.0r4LI3yGJ4@vostro.rjw.lan> (raw)
In-Reply-To: <57b8ab66ba21f42c91311641319cec16d2c8923d.1393318100.git.viresh.kumar@linaro.org>

On Tuesday, February 25, 2014 02:20:10 PM Viresh Kumar wrote:
> Policy must be fully initialized before it is being made available for use by
> others.

True enough.  And the problem is?

> This patch moves some initialization code before making policy available
> for others.

So why/how exactly does this fix the problem?

> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
>  drivers/cpufreq/cpufreq.c | 28 ++++++++++++++--------------
>  1 file changed, 14 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index cc4f244..110c0cd 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -1116,6 +1116,20 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif,
>  		goto err_set_policy_cpu;
>  	}
>  
> +	/* related cpus should atleast have policy->cpus */
> +	cpumask_or(policy->related_cpus, policy->related_cpus, policy->cpus);
> +
> +	/*
> +	 * affected cpus must always be the one, which are online. We aren't
> +	 * managing offline cpus here.
> +	 */
> +	cpumask_and(policy->cpus, policy->cpus, cpu_online_mask);
> +
> +	if (!frozen) {
> +		policy->user_policy.min = policy->min;
> +		policy->user_policy.max = policy->max;
> +	}
> +
>  	write_lock_irqsave(&cpufreq_driver_lock, flags);
>  	for_each_cpu(j, policy->cpus)
>  		per_cpu(cpufreq_cpu_data, j) = policy;
> @@ -1169,20 +1183,6 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif,
>  		}
>  	}
>  
> -	/* related cpus should atleast have policy->cpus */
> -	cpumask_or(policy->related_cpus, policy->related_cpus, policy->cpus);
> -
> -	/*
> -	 * affected cpus must always be the one, which are online. We aren't
> -	 * managing offline cpus here.
> -	 */
> -	cpumask_and(policy->cpus, policy->cpus, cpu_online_mask);
> -
> -	if (!frozen) {
> -		policy->user_policy.min = policy->min;
> -		policy->user_policy.max = policy->max;
> -	}
> -
>  	blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
>  				     CPUFREQ_START, policy);
>  
> 

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

  reply	other threads:[~2014-03-01  0:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-25  8:50 [PATCH 1/3] cpufreq: move call to __find_governor() to cpufreq_init_policy() Viresh Kumar
2014-02-25  8:50 ` [PATCH 2/3] cpufreq: Initialize policy before making it available for others to use Viresh Kumar
2014-03-01  1:14   ` Rafael J. Wysocki [this message]
2014-02-25  8:50 ` [PATCH 3/3] cpufreq: initialize governor for a new policy under policy->rwsem Viresh Kumar
2014-03-01  1:00 ` [PATCH 1/3] cpufreq: move call to __find_governor() to cpufreq_init_policy() Rafael J. Wysocki
2014-03-01  1:09 ` Rafael J. Wysocki
2014-03-04  3:43   ` Viresh Kumar

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=278741659.0r4LI3yGJ4@vostro.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=cpufreq@vger.kernel.org \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=skannan@codeaurora.org \
    --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 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®