linux-stable/sound
Edmund Raile f5043e69ae Revert "ALSA: firewire-lib: operate for period elapse event in process context"
commit 3dab73ab92 upstream.

Commit 7ba5ca32fe ("ALSA: firewire-lib: operate for period elapse event
in process context") removed the process context workqueue from
amdtp_domain_stream_pcm_pointer() and update_pcm_pointers() to remove
its overhead.

With RME Fireface 800, this lead to a regression since
Kernels 5.14.0, causing an AB/BA deadlock competition for the
substream lock with eventual system freeze under ALSA operation:

thread 0:
    * (lock A) acquire substream lock by
	snd_pcm_stream_lock_irq() in
	snd_pcm_status64()
    * (lock B) wait for tasklet to finish by calling
    	tasklet_unlock_spin_wait() in
	tasklet_disable_in_atomic() in
	ohci_flush_iso_completions() of ohci.c

thread 1:
    * (lock B) enter tasklet
    * (lock A) attempt to acquire substream lock,
    	waiting for it to be released:
	snd_pcm_stream_lock_irqsave() in
    	snd_pcm_period_elapsed() in
	update_pcm_pointers() in
	process_ctx_payloads() in
	process_rx_packets() of amdtp-stream.c

? tasklet_unlock_spin_wait
 </NMI>
 <TASK>
ohci_flush_iso_completions firewire_ohci
amdtp_domain_stream_pcm_pointer snd_firewire_lib
snd_pcm_update_hw_ptr0 snd_pcm
snd_pcm_status64 snd_pcm

? native_queued_spin_lock_slowpath
 </NMI>
 <IRQ>
_raw_spin_lock_irqsave
snd_pcm_period_elapsed snd_pcm
process_rx_packets snd_firewire_lib
irq_target_callback snd_firewire_lib
handle_it_packet firewire_ohci
context_tasklet firewire_ohci

Restore the process context work queue to prevent deadlock
AB/BA deadlock competition for ALSA substream lock of
snd_pcm_stream_lock_irq() in snd_pcm_status64()
and snd_pcm_stream_lock_irqsave() in snd_pcm_period_elapsed().

revert commit 7ba5ca32fe ("ALSA: firewire-lib: operate for period
elapse event in process context")

Replace inline description to prevent future deadlock.

Cc: stable@vger.kernel.org
Fixes: 7ba5ca32fe ("ALSA: firewire-lib: operate for period elapse event in process context")
Reported-by: edmund.raile <edmund.raile@proton.me>
Closes: https://lore.kernel.org/r/kwryofzdmjvzkuw6j3clftsxmoolynljztxqwg76hzeo4simnl@jn3eo7pe642q/
Signed-off-by: Edmund Raile <edmund.raile@protonmail.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20240730195318.869840-3-edmund.raile@protonmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-08-11 12:47:25 +02:00
..
ac97 ALSA: ac97: set variables dev_attr_vendor_id to static 2023-08-02 09:27:39 +02:00
aoa ALSA: aoa: Fix typos in PCM fix patch 2023-08-18 09:09:39 +02:00
arm
atmel
core ALSA: seq: ump: Optimize conversions from SysEx to UMP 2024-08-11 12:47:25 +02:00
drivers ALSA: pcmtest: stop timer before buffer is released 2024-01-20 11:51:42 +01:00
firewire Revert "ALSA: firewire-lib: operate for period elapse event in process context" 2024-08-11 12:47:25 +02:00
hda ALSA/hda: intel-dsp-config: Document AVS as dsp_driver option 2024-06-27 13:49:05 +02:00
i2c
isa ALSA: cs4231: Fix -Wformat-truncation warning for longname string 2023-09-15 13:23:01 +02:00
mips
oss
parisc
pci ALSA: hda/realtek: Add quirk for Acer Aspire E5-574G 2024-08-11 12:47:25 +02:00
pcmcia
ppc
sh ALSA: sh: aica: reorder cleanup operations to avoid UAF bugs 2024-04-03 15:28:59 +02:00
soc ASoC: TAS2781: Fix tasdev_load_calibrated_data() 2024-08-03 08:54:40 +02:00
sparc
spi
synth ALSA: emux: improve patch ioctl data validation 2024-07-05 09:33:52 +02:00
usb ALSA: usb-audio: Correct surround channels in UAC1 channel map 2024-08-11 12:47:25 +02:00
virtio
x86
xen ALSA: xen: Fix -Wformat-truncation warning 2023-09-15 13:21:35 +02:00
ac97_bus.c
Kconfig This pull request contains the following changes for UML: 2023-09-04 11:32:21 -07:00
last.c
Makefile
sound_core.c