Re: [PATCH] regulator: simplify locking
From: Mark Brown
Date: Mon Aug 10 2020 - 12:23:38 EST
On Mon, Aug 10, 2020 at 12:30:30AM +0200, Michał Mirosław wrote:
> On Mon, Aug 10, 2020 at 12:40:04AM +0300, Dmitry Osipenko wrote:
> > 10.08.2020 00:16, Michał Mirosław пишет:
> > > - mutex_lock(®ulator_nesting_mutex);
> > > + if (ww_ctx || !mutex_trylock_recursive(&rdev->mutex.base))
> > Have you seen comment to the mutex_trylock_recursive()?
> > https://elixir.bootlin.com/linux/v5.8/source/include/linux/mutex.h#L205
> > * This function should not be used, _ever_. It is purely for hysterical GEM
> > * raisins, and once those are gone this will be removed.
> I think that reimplementing the function just to not use it is not the
> right solution. The whole locking protocol is problematic and this patch
> just uncovers one side of it.
OTOH if this is just making the issue more obvious rather than fixing it
then it's much harder to justify adding a new usage of a function people
are trying to remove. The coupled regulator stuff is definitely a mess
as far as locking is concerned, it really interferes with the model we
had handling regulators separately as much as possible since we're no
longer just walking back up the tree. ww does seem like the way
Description: PGP signature