Re: MMC/regulator boot hang in -next

From: John Stultz
Date: Mon Nov 02 2015 - 17:03:20 EST


On Mon, Nov 2, 2015 at 12:46 PM, Bjorn Andersson
<bjorn.andersson@xxxxxxxxxxxxxx> wrote:
> On Mon 02 Nov 11:57 PST 2015, John Stultz wrote:
>
>> Trying to move my nexus7 work to -next, I started seeing boot time
>> hangs. Enabling some debug options provided with a lockdep spew.
>>
>> Reverting "regulator: core: Propagate voltage changes to supply
>> regulators" - fc42112c0eaa avoids the hang, but I still see lockdep
>> noise.
>>
>> Full log of -next based tree without any reverts follows:
>
> It sure does lock like a deadlock to me. Can you figure out which
> regulator we're talking about here? And confirm that this is 8064 we're
> talking about

So it looks like we're setting the voltage on lvs1, which then calls
get_voltage() on s4. At that point the lockdep spew hits.

But as Mark noted *this* spew looks like a false positive, but I
suspect lockdep is then disabled and can't detect the real hang
happens shortly afterwards.

The key bit needed to revert to get things booting for me in
fc42112c0eaa ("regulator: core: Propagate voltage changes to supply
regulators") is (sorry, copy pasted text here, apologies for the
whitespace damage):
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2952,11 +2952,12 @@ int regulator_set_voltage(struct regulator
*regulator, int min_uV, int max_uV)
{
int ret = 0;

- regulator_lock_supply(regulator->rdev);
+ mutex_lock(&regulator->rdev->mutex);

ret = regulator_set_voltage_unlocked(regulator, min_uV, max_uV);

- regulator_unlock_supply(regulator->rdev);
+ mutex_unlock(&regulator->rdev->mutex);

return ret;
}


Might the problem be here that we lock the supply in set_voltage, then
if we call _regulator_get_voltage on the supply later, we try to grab
the same lock and we're stuck?

thanks
-john
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/