Re: [PATCH V3] PM / OPP: Don't remove the first cpu in the mask before removing others

From: Rafael J. Wysocki
Date: Tue Nov 29 2016 - 07:50:09 EST


On Tue, Nov 29, 2016 at 6:42 AM, Viresh Kumar <viresh.kumar@xxxxxxxxxx> wrote:
> Joonyoung Shim reported an interesting problem on his ARM octa-core
> Odoroid-XU3 platform. During system suspend, dev_pm_opp_put_regulator()
> was failing for a struct device for which dev_pm_opp_set_regulator() is
> called earlier.
>
> This happened because an earlier call to
> dev_pm_opp_of_cpumask_remove_table() function (from cpufreq-dt.c file)
> removed all the entries from opp_table->dev_list apart from the last CPU
> device in the cpumask of CPUs sharing the OPP.
>
> But both dev_pm_opp_set_regulator() and dev_pm_opp_put_regulator()
> routines get CPU device for the first CPU in the cpumask. And so the OPP
> core failed to find the OPP table for the struct device.
>
> In order to fix that up properly, we need to revisit APIs like
> dev_pm_opp_set_regulator() and make them talk in terms of cookies
> provided by the OPP core. But such a solution will be hard to backport
> to stable kernels.
>
> This patch attempts to fix this problem (in a Hacky way) by specially
> handling the first cpu in the mask. A FIXME is also added to make sure
> that this Hack doesn't get unnoticed later on.
>
> Cc: # v4.4+ <stable@xxxxxxxxxxxxxxx>
> Signed-off-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
> ---
> V2->V3:
> - Fix $Subject, which carried text from V1.
>
> V1->V2:
> - A completely different approach, more of hack so that backport to
> stable kernels can be done easily.
> - A more comprehensive solution is required to fix the design flaws.

I'll wait for a response from Stephen this time.

Thanks,
Rafael