Re: [PATCH 0/2] cpufreq/opp: rework regulator initialization

Sudeep Holla
2019-02-11T14:08:29Z

On Mon, Feb 11, 2019 at 02:17:14PM +0530, Viresh Kumar wrote:
> On 08-02-19, 17:41, Sudeep Holla wrote:
> > Based on Rafael's suggestion, I cooked up something. See if this helps ?
> > The policy to cpu dance can be removed and we can just run through the
> > online cpumask I think.
> >
> > Regards,
> > Sudeep
> >
> > -->8
> >
> > diff --git i/drivers/cpufreq/cpufreq.c w/drivers/cpufreq/cpufreq.c
> > index e35a886e00bc..03d65a02a542 100644
> > --- i/drivers/cpufreq/cpufreq.c
> > +++ w/drivers/cpufreq/cpufreq.c
> > @@ -1640,6 +1640,7 @@ EXPORT_SYMBOL(cpufreq_generic_suspend);
> > void cpufreq_suspend(void)
> > {
> > struct cpufreq_policy *policy;
> > + int cpu;
> >
> > if (!cpufreq_driver)
> > return;
> > @@ -1662,6 +1663,11 @@ void cpufreq_suspend(void)
> > }
> >
> > suspend:
> > + if (cpufreq_driver->flags & CPUFREQ_DEFER_INIT_DURING_RESUME)
> > + for_each_active_policy(policy)
> > + for_each_cpu(cpu, policy->cpus)
> > + cpufreq_offline(cpu);
>
> You will offline boot-cpu as well :)
>

Indeed, I was just trying to check the idea of flags and clearly missed
the boot cpu :(

[..]

> > @@ -2444,14 +2455,16 @@ static enum cpuhp_state hp_online;
> >
> > static int cpuhp_cpufreq_online(unsigned int cpu)
> > {
> > - cpufreq_online(cpu);
> > + if (!(cpufreq_driver->flags & CPUFREQ_DEFER_INIT_DURING_RESUME))
> > + cpufreq_online(cpu);
>
> This isn't correct as we can offline the CPUs without suspend as well
> and cpufreq_online/offline should always be called in such cases.
>

Understood

> Anyways, I have cc'd you on another series which may end up fixing
> this problem as well.

Sure, will have a look.

--
Regards,
Sudeep