On Tue, 30 Jul 2024 12:18:03 +0200,
Jaroslav Kysela wrote:
>
> On 29. 07. 24 18:06, Takashi Iwai wrote:
> > The code path for kcontrol accesses have often nested locks of both
> > card's controls_rwsem and power_ref, and applies in that order.
> > However, what could take much longer is the latter, power_ref; it
> > waits for the power state of the device, and it pretty much depends on
> > the user's action.
> >
> > This patch swaps the locking order of those locks to a more natural
> > way, namely, power_ref -> controls_rwsem, in order to shorten the time
> > of possible nested locks. For consistency, power_ref is taken always
> > in the top-level caller side (that is, *_user() functions and the
> > ioctl handler itself).
> >
> > Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
>
> It looks fine, but perhaps, we can DEFINE_GUARD for
> snd_power_ref_and_wait and use this scoped guard, too? It would
> greatly simplify code.
I thought of that, but it's a bit more complicated because it's a
version with *_try (so you have to define more). I'd replace as a
refactoring later.
thanks,
Takashi
[Index of Archives]
[Pulseaudio]
[Linux Audio Users]
[ALSA Devel]
[Fedora Desktop]
[Fedora SELinux]
[Big List of Linux Books]
[Yosemite News]
[KDE Users]