Re: regulator: deadlock vs memory reclaim
From: Mark Brown
Date: Mon Aug 10 2020 - 15:51:51 EST
On Mon, Aug 10, 2020 at 10:41:54PM +0300, Dmitry Osipenko wrote:
> 10.08.2020 22:25, Michał Mirosław пишет:
> >> The initialization cases that are the trigger are only done for coupled
> >> regulators though AFAICT, otherwise we're not doing allocations with the
> >> lock held and should be able to progress.
> > I caught a few lockdep complaints that suggest otherwise, but I'm still
> > looking into that.
> The problem looks obvious to me. The regulator_init_coupling() is
> protected with the list_mutex, the regulator_lock_dependent() also
> protected with the list_mutex. Hence if offending reclaim happens from
> init_coupling(), then there is a lockup.
We may also have problems if I/O triggers allocations for some reason,
though that's also going to be a limited set of cases. Might be what
lockdep was showing though.
> It should be enough just to keep the regulator_find_coupler() under
> lock, or even completely remove the locking around init_coupling(). I
> think it should be better to keep the find_coupler() protected.
> Michał, does this fix yours problem?
That was the sort of thing I was thinking about here - it should at
least be an improvement if nothing else.
Attachment:
signature.asc
Description: PGP signature