Re: [PATCH RFC] ALSA: control: Avoid nested locks at notification

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 23. 05. 23 17:52, Takashi Iwai wrote:
The new control layer stuff introduced the nested rwsem for managing
the list of registered control layer ops.  Since then, a global
snd_ctl_layer_rwsem is always read at each time a control notification
is sent via snd_ctl_notify*() in a nested matter inside the card's
controls_rwsem lock.  This also required a bit complicated way of the
lock at snd_ctl_activate_id() and snd_ctl_elem_write() with the
downgrade of rwsem.

This patch is an attempt to simplify the handling of ctl layer ops.
Now, instead of traversing the global linked list, we keep a local
list of lops in each card instance.  This reduces the need of the
global snd_ctl_layer_rwsem lock at snd_ctl_notify*() invocation.
And, since the nested lock is avoided in most places, we can also
avoid the rwsem downgrade hack in the above, too.

Since the local list entry is created dynamically,
snd_ctl_register_layer() may return an error, and the caller needs to
check the return value.

I'm not convinced about this transition. What about to move the layer notifications to a workqueue to reorder the controls_rwsem locking (kctl access) ?

Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
---

I noticed the nested lock while looking at the pending bug report

From the log or code ?

				Jaroslav

--
Jaroslav Kysela <perex@xxxxxxxx>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.




[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux