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@suse.de
I noticed the nested lock while looking at the pending bug report
From the log or code ?
Jaroslav