Re: Regulator regression in next-20180305

From: Maciej Purski
Date: Wed Mar 07 2018 - 09:37:15 EST



On 03/07/2018 03:10 PM, Mark Brown wrote:
On Wed, Mar 07, 2018 at 01:57:12PM +0100, Maciej Purski wrote:

I'm trying to figure out what is so special about these boards. The only
strange thing, that I haven't noticed at first, is that all regulators share
a common supply - dummy regulator. It is defined in anatop_regulator.c.

No, that's a regulator framework thing - the regulator framework will
use the dummy regulator as a supply when there's nothing described in
the DT so long as the client doesn't explicitly tell it that the supply
might be optional.


Ok, thanks for explanation. I think I have found a possibly dangerous scenario, but I can't see this situation possible in Fabio's case.

Assume, that we have a chain of supplies, consisting of at least 3. Say: A->B->C.

When we're setting voltage on A, we lock it, call balance_voltage(), lock suppliers and call set_voltage_rdev(). So we have regulators A, B, C locked. Then set_voltage_rdev() is trying to set voltage of its supply by calling set_voltage_unlocked().

Now we're on the regulator B. Set_voltage_unlocked() calls balance_voltage(), which again locks its supplies, if they exist. B's supply is C, so we end up with having a deadlock on regulator C.

Tony and Fabio, do you find this scenario possible on your boards?

Best regards
Maciej Purski