Re: [PATCH] ASoC: cs42l43: Move shutter IRQ handling into a worker thread

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



On Mon, 29 Jul 2024 18:44:59 +0200,
Charles Keepax wrote:
> 
> On Mon, Jul 29, 2024 at 06:18:50PM +0200, Takashi Iwai wrote:
> > On Mon, 29 Jul 2024 17:59:32 +0200,
> > Charles Keepax wrote:
> > > 
> > > The microphone/speaker privacy shutter ALSA control handlers need to
> > > call pm_runtime_resume, since the hardware needs to be powered up to
> > > check the hardware state of the shutter. The IRQ handler for the
> > > shutters also needs to notify the ALSA control to inform user-space
> > > the shutters updated. However this leads to a mutex inversion, between
> > > the sdw_dev_lock and the controls_rwsem.
> > 
> > That's bad, how does the mutex inversion look like?  Generally
> > speaking, a call of snd_ctl_notify() from an irq handler is a very
> > standard procedure, and it should work without too much workaround.
> > 
> 
> SoundWire IRQs are called under the sdw_dev_lock, and then in the
> IRQ handler we call snd_ctl_notify which takes controls_rwsem.

snd_ctl_notify() doesn't take rwsem but ctl_files_rwlock.
And rwlock isn't taken except for two cases, at a list traverse at
enumerating from user-space and at the device disconnection, so it
shouldn't race.  Anything missing there...?


thanks,

Takashi

> On
> the other side, in the ALSA control handler which is obviously
> called under the controls_rwsem, we do a pm_runtime_resume, which
> causes SoundWire stuff to happen that takes the sdw_dev_lock.
> 
> Thanks,
> Charles




[Index of Archives]     [Pulseaudio]     [Linux Audio Users]     [ALSA Devel]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux