linux/sound/firewire
Edmund Raile 7c07220cf6 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-19 05:45:34 +02:00
..
bebob ALSA: bebob: correct duplicated entries with TerraTec OUI 2021-07-05 19:31:12 +02:00
dice ALSA: dice: fix regression for Lexicon I-ONIX FW810S 2022-12-08 11:28:42 +01:00
digi00x ALSA: firewire-digi00x: prevent potential use after free 2023-05-24 17:36:49 +01:00
fireface ALSA: fireface: cease from delayed card registration 2021-06-07 17:14:48 +02:00
fireworks ALSA: fireworks: fix wrong return count shorter than expected by 4 bytes 2022-05-12 12:30:01 +02:00
motu ALSA: firewire-motu: fix truncated bytes in message tracepoints 2021-09-21 18:48:32 +02:00
oxfw ALSA: oxfw: fix functional regression for Mackie Onyx 1640i in v5.14 or later 2021-11-18 19:16:57 +01:00
tascam ALSA: firewire-tascam: add missing unwind goto in snd_tscm_stream_start_duplex() 2023-04-20 12:13:51 +02:00
amdtp-am824.c ALSA: firewire-lib/motu: use int type for the value of bitwise OR with enumerator-constant 2021-05-18 12:21:52 +02:00
amdtp-am824.h ALSA: firewire-lib/motu: use int type for the value of bitwise OR with enumerator-constant 2021-05-18 12:21:52 +02:00
amdtp-stream-trace.h ALSA: firewire-lib: replace in_interrupt() with in_softirq() 2021-06-12 09:31:41 +02:00
amdtp-stream.c Revert "ALSA: firewire-lib: operate for period elapse event in process context" 2024-08-19 05:45:34 +02:00
amdtp-stream.h Revert "ALSA: firewire-lib: obsolete workqueue for period update" 2024-08-19 05:45:34 +02:00
cmp.c
cmp.h
fcp.c ALSA: firewire-lib: fix uninitialized flag for AV/C deferred transaction 2022-04-08 14:23:20 +02:00
fcp.h
isight.c
iso-resources.c
iso-resources.h
Kconfig ALSA: bebob: add support for ToneWeal FW66 2021-06-20 08:42:27 +02:00
lib.c ALSA: firewire-lib: delete unused kernel API 2021-06-07 17:14:54 +02:00
lib.h ALSA: firewire-lib: delete unused kernel API 2021-06-07 17:14:54 +02:00
Makefile
packets-buffer.c
packets-buffer.h