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 :) > + > cpufreq_suspended = true; > } > > @@ -1674,7 +1680,7 @@ void cpufreq_suspend(void) > void cpufreq_resume(void) > { > struct cpufreq_policy *policy; > - int ret; > + int ret, cpu; > > if (!cpufreq_driver) > return; > @@ -1682,6 +1688,11 @@ void cpufreq_resume(void) > if (unlikely(!cpufreq_suspended)) > return; > > + if (cpufreq_driver->flags & CPUFREQ_DEFER_INIT_DURING_RESUME) > + for_each_active_policy(policy) > + for_each_cpu(cpu, policy->cpus) > + cpufreq_online(cpu); > + > cpufreq_suspended = false; > > if (!has_target() && !cpufreq_driver->resume) > @@ -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. Anyways, I have cc'd you on another series which may end up fixing this problem as well. -- viresh