summaryrefslogtreecommitdiff
path: root/tools/lib/python/kdoc
diff options
context:
space:
mode:
authorPiotr Gliźniewicz <p.glizniewicz@gmail.com>2026-10-16 09:31:30 +0200
committerTakashi Iwai <tiwai@suse.de>2026-10-16 18:46:07 +0200
commitd030561d53cb272bb55ba2dd11aaa609e8240b7e (patch)
tree96c5e151857044883f98e2dfad77172410e2c435 /tools/lib/python/kdoc
parenta19bf815f40afddac5719a1edb3c46710a52819b (diff)
ALSA: 6fire: take stream_mutex in the Digital Thru control
usb6fire_control_digital_thru_put() calls usb6fire_control_streaming_update(), which on an idle card with Digital Thru on selects altsetting 2 and writes the clock register for 96 kHz through usb6fire_control_set_rate(). usb6fire_pcm_prepare() calls both functions through usb6fire_pcm_set_rate() under rt->stream_mutex. The put does not take stream_mutex, so the two can run at the same time. 500 runs of a 0.2 s aplay at 48 kHz while a second loop toggled "Digital Thru Playback Route" with amixer (12693 on/off cycles, kernel 7.2.9): in 216 cases the two usb_set_interface() calls ran at the same time and the kernel logged "sysfs: cannot create duplicate filename '.../3-2:1.1/ep_82'" with a stack dump. 27 of the aplay runs failed, and for each of them the kernel logged "could not start pcm stream". Take stream_mutex in the put. The pcm runtime is created before the controls and freed with the card, so chip->pcm is valid whenever the put runs. The put waits for a running prepare, which makes synchronous USB transfers under stream_mutex; on a card that responds late the wait can reach about 12 s, or 24 s with Digital Thru on, and during the wait the other controls of the card can be neither read nor written, because snd_ctl_elem_write() holds controls_rwsem around the put. Before this patch the put already made transfers of the same kind under controls_rwsem. No code that holds stream_mutex takes controls_rwsem. The same test on kernel 7.2.10 with this patch (12863 cycles) gave no failed aplay run and no "duplicate filename" message. Fixes: 2475b0d40761 ("ALSA: 6fire - Add support of digital-thru mixer") Assisted-by: LLM Signed-off-by: Piotr Gliźniewicz <p.glizniewicz@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20261016073132.109288-2-p.glizniewicz@gmail.com
Diffstat (limited to 'tools/lib/python/kdoc')
0 files changed, 0 insertions, 0 deletions