On Tue, 11 Jul 2023 12:11:30 +0200, Oswald Buddenhagen wrote: > > On Tue, Jul 11, 2023 at 07:28:22AM +0200, Takashi Iwai wrote: > > Again, snd_ctl_notify() itself doesn't need the rwsem lock at all. > > > ah, you mean i could fully release it before the notification. > > > It's snd_ctl_notify_one() that needs a more careful call pattern. > > > i suppose that's because the snd_ctl_layer callbacks might require it. > i would recommend actually documenting that. Yes, but this helper itself needs more change at first, I'm afraid. The current implementation with the nested rwsem is fragile. It's a new stuff (or new restriction), and it's to be revisited. > > And, that ugly implementation is a thing to be improved in future in > > ALSA core side. > > > it is? like, really? Yes. See my earlier RFC patch for reducing the nested rwlock, for example. Jaroslav didn't like the implementation, so it needs more respin, though. Another idea could to be make the controls_rwsem back to read-only for both get and put, but introduce another lock just wrapping around get/put call (but conditionally - there are drivers that don't need it). This will avoid the rwsem deadlock problem. Takashi