|
|
|
|
|
|
|
|
|
|
xen-devel
RE: [Xen-devel] [PATCH]Make sure processor_pminfo initialized before use
Umm... After checking, the panic due to my mistake to add the debug instruction
to print the value of processor_pminfo[cpu]->perf. Please just ignore this
patch.
Thanks for pointing out this.
best regards
yang
> -----Original Message-----
> From: Jan Beulich [mailto:JBeulich@xxxxxxxx]
> Sent: Thursday, September 08, 2011 5:13 PM
> To: Zhang, Yang Z
> Cc: xen-devel@xxxxxxxxxxxxxxxxxxx; Keir Fraser
> Subject: Re: [Xen-devel] [PATCH]Make sure processor_pminfo initialized before
> use it
>
> >>> On 08.09.11 at 08:09, "Zhang, Yang Z" <yang.z.zhang@xxxxxxxxx> wrote:
> > Make sure processor_pminfo not null before use it
> >
> > If processor_pminfo not initialized, it will cause xen panic.
>
> Mind pointing out what panic you observed, because ...
>
> > Signed-off-by: Yang Zhang <yang.z.zhang@xxxxxxxxx>
> >
> > diff -r bdd19847ae63 xen/drivers/cpufreq/cpufreq.c
> > --- a/xen/drivers/cpufreq/cpufreq.c Wed Sep 07 10:37:48 2011 +0100
> > +++ b/xen/drivers/cpufreq/cpufreq.c Thu Sep 08 13:40:23 2011 +0800
> > @@ -91,7 +91,7 @@ int __init cpufreq_register_governor(str
> >
> > int cpufreq_limit_change(unsigned int cpu) {
> > - struct processor_performance *perf = &processor_pminfo[cpu]->perf;
> > + struct processor_performance *perf;
>
> ... this (and all other changed instances below) is not actually
> de-referencing
> processor_pminfo[cpu], and the first de-reference always is only after that
> one
> got checked against NULL.
>
> Jan
>
> > struct cpufreq_policy *data;
> > struct cpufreq_policy policy;
> >
> > @@ -99,6 +99,7 @@ int cpufreq_limit_change(unsigned int cp
> > !processor_pminfo[cpu])
> > return -ENODEV;
> >
> > + perf = &processor_pminfo[cpu]->perf;
> > if (perf->platform_limit >= perf->state_count)
> > return -EINVAL;
> >
> > @@ -120,12 +121,14 @@ int cpufreq_add_cpu(unsigned int cpu)
> > struct cpufreq_dom *cpufreq_dom = NULL;
> > struct cpufreq_policy new_policy;
> > struct cpufreq_policy *policy;
> > - struct processor_performance *perf = &processor_pminfo[cpu]->perf;
> > + struct processor_performance *perf;
> >
> > /* to protect the case when Px was not controlled by xen */
> > - if (!processor_pminfo[cpu] ||
> > - !(perf->init & XEN_PX_INIT) ||
> > - !cpu_online(cpu))
> > + if (!processor_pminfo[cpu] || !cpu_online(cpu))
> > + return -EINVAL;
> > +
> > + perf = &processor_pminfo[cpu]->perf;
> > + if (!(perf->init & XEN_PX_INIT))
> > return -EINVAL;
> >
> > if (!cpufreq_driver)
> > @@ -261,12 +264,14 @@ int cpufreq_del_cpu(unsigned int cpu)
> > struct list_head *pos;
> > struct cpufreq_dom *cpufreq_dom = NULL;
> > struct cpufreq_policy *policy;
> > - struct processor_performance *perf = &processor_pminfo[cpu]->perf;
> > + struct processor_performance *perf;
> >
> > /* to protect the case when Px was not controlled by xen */
> > - if (!processor_pminfo[cpu] ||
> > - !(perf->init & XEN_PX_INIT) ||
> > - !cpu_online(cpu))
> > + if (!processor_pminfo[cpu] || !cpu_online(cpu))
> > + return -EINVAL;
> > +
> > + perf = &processor_pminfo[cpu]->perf;
> > + if (!(perf->init & XEN_PX_INIT))
> > return -EINVAL;
> >
> > if (!per_cpu(cpufreq_cpu_policy, cpu))
> >
> >
> >
> > _______________________________________________
> > Xen-devel mailing list
> > Xen-devel@xxxxxxxxxxxxxxxxxxx
> > http://lists.xensource.com/xen-devel
>
>
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
|
|
|
|