From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH v5 5/9] x86/intel_pstate: changes in cpufreq_del_cpu for CPU offline Date: Thu, 17 Sep 2015 16:43:43 +0100 Message-ID: <55FADFAF.2000304@citrix.com> References: <1442197930-3738-1-git-send-email-wei.w.wang@intel.com> <1442197930-3738-6-git-send-email-wei.w.wang@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1442197930-3738-6-git-send-email-wei.w.wang@intel.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Wei Wang , jbeulich@suse.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On 14/09/15 03:32, Wei Wang wrote: > We change to NULL the cpufreq_cpu_policy pointer after the call of > cpufreq_driver->exit, because the pointer is still needed in > intel_pstate_set_pstate(). > > Signed-off-by: Wei Wang > --- > xen/drivers/cpufreq/cpufreq.c | 6 +++--- > xen/include/acpi/cpufreq/cpufreq.h | 7 +++++++ > 2 files changed, 10 insertions(+), 3 deletions(-) > > changes in v5: > 1) put this patch prior to the "main body of intel pstate driver", which is > one of the acceptable options suggested by the Jan. > > diff --git a/xen/drivers/cpufreq/cpufreq.c b/xen/drivers/cpufreq/cpufreq.c > index 0c437d4..5485944 100644 > --- a/xen/drivers/cpufreq/cpufreq.c > +++ b/xen/drivers/cpufreq/cpufreq.c > @@ -334,12 +334,11 @@ int cpufreq_del_cpu(unsigned int cpu) > > /* for HW_ALL, stop gov for each core of the _PSD domain */ > /* for SW_ALL & SW_ANY, stop gov for the 1st core of the _PSD domain */ > - if (hw_all || (cpumask_weight(cpufreq_dom->map) == > - perf->domain_info.num_processors)) > + if (!policy->internal_gov && (hw_all || (cpumask_weight(cpufreq_dom->map) == > + perf->domain_info.num_processors))) This will be easier to read if you change the location of the linebreak as such: perf->domain_info.num_processors))) if (!policy->internal_gov && (hw_all || (cpumask_weight(cpufreq_dom->map) == perf->domain_info.num_processors))) > __cpufreq_governor(policy, CPUFREQ_GOV_STOP); > > cpufreq_statistic_exit(cpu); > - per_cpu(cpufreq_cpu_policy, cpu) = NULL; > cpumask_clear_cpu(cpu, policy->cpus); > cpumask_clear_cpu(cpu, cpufreq_dom->map); > > @@ -348,6 +347,7 @@ int cpufreq_del_cpu(unsigned int cpu) > free_cpumask_var(policy->cpus); > xfree(policy); > } > + per_cpu(cpufreq_cpu_policy, cpu) = NULL; > > /* for the last cpu of the domain, clean room */ > /* It's safe here to free freq_table, drv_data and policy */ > diff --git a/xen/include/acpi/cpufreq/cpufreq.h b/xen/include/acpi/cpufreq/cpufreq.h > index c6976d0..48bd94d 100644 > --- a/xen/include/acpi/cpufreq/cpufreq.h > +++ b/xen/include/acpi/cpufreq/cpufreq.h > @@ -53,6 +53,12 @@ struct perf_limits { > uint32_t min_policy_pct; > }; > > +struct internal_governor { > + char *avail_gov; > + uint32_t gov_num; > + uint32_t cur_gov; > +}; > + Adding this structure needs a mention in the commit message. ~Andrew