All of lore.kernel.org
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: Pan Xinhui <xinhuix.pan@intel.com>
Cc: linux-pm@vger.kernel.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	rjw@rjwysocki.net, "mnipxh@163.com" <mnipxh@163.com>,
	"yanmin_zhang@linux.intel.com" <yanmin_zhang@linux.intel.com>
Subject: Re: [PATCH] acpi-cpufreq: use same acpi_cpufreq_data if policy is shared
Date: Fri, 3 Jul 2015 14:16:57 +0530	[thread overview]
Message-ID: <20150703084657.GB23297@linux> (raw)
In-Reply-To: <5596414C.4090106@intel.com>

On 03-07-15, 16:01, Pan Xinhui wrote:
> 
> cpufreq core will mark all cpus in policy->cpus as initialized
> by setting percpu cpufreq_cpu_data = policy.
> However in acpi-cpufreq, we did not set percpu acpi_cpufreq_data for
> all cpus in policy->cpus.
> That will cause a issue that when we call get_cur_freq_on_cpu for a
> cpu, it returns zero instead of a correct value.
> 
> So we shared acpi_cpufreq_data for all those cpus in policy->cpus.
> 
> Signed-off-by: xinhuix.pan <xinhuix.pan@intel.com>
> ---
>  drivers/cpufreq/acpi-cpufreq.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
> index 0136dfc..6c6dc97 100644
> --- a/drivers/cpufreq/acpi-cpufreq.c
> +++ b/drivers/cpufreq/acpi-cpufreq.c
> @@ -673,6 +673,7 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
>  	}
>  
>  	data->acpi_data = per_cpu_ptr(acpi_perf_data, cpu);
> +	cpumask_copy(policy->cpus, cpumask_of(cpu));

This is already done by cpufreq-core before calling ->init() and so
isn't required.

>  	per_cpu(acfreq_data, cpu) = data;
>  
>  	if (cpu_has(c, X86_FEATURE_CONSTANT_TSC))
> @@ -712,6 +713,10 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
>  	}
>  #endif
>  
> +	for_each_cpu(i, policy->cpus) {
> +		per_cpu(acfreq_data, i) = data;
> +	}
> +
>  	/* capability check */
>  	if (perf->state_count <= 1) {
>  		pr_debug("No P-States\n");
> @@ -843,7 +848,9 @@ err_free_mask:
>  	free_cpumask_var(data->freqdomain_cpus);
>  err_free:
>  	kfree(data);
> -	per_cpu(acfreq_data, cpu) = NULL;
> +	for_each_cpu(i, policy->cpus) {
> +		per_cpu(acfreq_data, i) = NULL;
> +	}

The per-cpu thing is basically wrong to start with. cpufreq-policy has
a field: 'driver_data', which can be used to replace this acfreq_data.
Probably use that and things will get fixed by themselves.

-- 
viresh

      reply	other threads:[~2015-07-03  8:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-03  8:01 [PATCH] acpi-cpufreq: use same acpi_cpufreq_data if policy is shared Pan Xinhui
2015-07-03  8:46 ` Viresh Kumar [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=20150703084657.GB23297@linux \
    --to=viresh.kumar@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mnipxh@163.com \
    --cc=rjw@rjwysocki.net \
    --cc=xinhuix.pan@intel.com \
    --cc=yanmin_zhang@linux.intel.com \
    /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.