linux/sound
Edmund Raile 36c255db5a 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:57:59 +02:00
..
ac97 ALSA: ac97: bus: Add missing module description 2024-05-09 10:13:07 +02:00
aoa ALSA: aoa: Use *-y instead of *-objs in Makefile 2024-05-08 18:18:08 +02:00
arm ASoC: Updates for v6.10 2024-05-13 11:39:49 +02:00
atmel ALSA: misc: Use *-y instead of *-objs in Makefile 2024-05-08 18:18:13 +02:00
core ALSA: seq: ump: Optimize conversions from SysEx to UMP 2024-08-11 12:57:58 +02:00
drivers ALSA: pcmtest: Add missing module descriptions 2024-05-09 10:13:07 +02:00
firewire Revert "ALSA: firewire-lib: operate for period elapse event in process context" 2024-08-11 12:57:59 +02:00
hda ALSA/hda: intel-dsp-config: Document AVS as dsp_driver option 2024-06-13 14:11:43 +02:00
i2c ALSA: misc: Use *-y instead of *-objs in Makefile 2024-05-08 18:18:13 +02:00
isa ALSA: isa: Use *-y instead of *-objs in Makefile 2024-05-08 18:17:48 +02:00
mips ALSA: misc: Use *-y instead of *-objs in Makefile 2024-05-08 18:18:13 +02:00
oss sound/oss/dmasound: add missing MODULE_DESCRIPTION() macro 2024-06-18 11:55:53 +02:00
parisc ALSA: misc: Use *-y instead of *-objs in Makefile 2024-05-08 18:18:13 +02:00
pci ALSA: hda/realtek: Add quirk for Acer Aspire E5-574G 2024-08-11 12:57:58 +02:00
pcmcia ALSA: misc: Use *-y instead of *-objs in Makefile 2024-05-08 18:18:13 +02:00
ppc ALSA: misc: Use *-y instead of *-objs in Makefile 2024-05-08 18:18:13 +02:00
sh ALSA: misc: Use *-y instead of *-objs in Makefile 2024-05-08 18:18:13 +02:00
soc ASoC: TAS2781: Fix tasdev_load_calibrated_data() 2024-08-03 09:01:06 +02:00
sparc ALSA: misc: Use *-y instead of *-objs in Makefile 2024-05-08 18:18:13 +02:00
spi ALSA: misc: Use *-y instead of *-objs in Makefile 2024-05-08 18:18:13 +02:00
synth ALSA: misc: Use *-y instead of *-objs in Makefile 2024-05-08 18:18:13 +02:00
usb ALSA: usb-audio: Correct surround channels in UAC1 channel map 2024-08-11 12:57:58 +02:00
virtio virtio: features, fixes, cleanups 2024-05-23 12:04:36 -07:00
x86 ALSA: misc: Use *-y instead of *-objs in Makefile 2024-05-08 18:18:13 +02:00
xen ALSA: misc: Use *-y instead of *-objs in Makefile 2024-05-08 18:18:13 +02:00
ac97_bus.c ALSA: ac97: legacy: Add missing module description 2024-05-09 10:13:07 +02:00
Kconfig This pull request contains the following changes for UML: 2023-09-04 11:32:21 -07:00
last.c
Makefile ALSA: core: Use *-y instead of *-objs in Makefile 2024-05-08 18:17:32 +02:00
sound_core.c sound: make all 'class' structures const 2023-06-21 07:29:10 +02:00