Bug 218816 - Deadlock between snd_ctl_elem_info and snd_pcm_dev_disconnect
Summary: Deadlock between snd_ctl_elem_info and snd_pcm_dev_disconnect
Status: RESOLVED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: Sound(ALSA) (show other bugs)
Hardware: All Linux
: P3 normal
Assignee: Jaroslav Kysela
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-05-07 20:54 UTC by Richard van der Hoff
Modified: 2024-05-15 06:01 UTC (History)
1 user (show)

See Also:
Kernel Version:
Subsystem:
Regression: No
Bisected commit-id:


Attachments
dmesg (6.57 KB, text/plain)
2024-05-07 20:54 UTC, Richard van der Hoff
Details
Test fix patch (611 bytes, patch)
2024-05-08 07:03 UTC, Takashi Iwai
Details | Diff

Description Richard van der Hoff 2024-05-07 20:54:28 UTC
Created attachment 306269 [details]
dmesg

I regularly see a deadlock between `wireplumber` and a kernel thread handling a USB disconnect. I can reproduce this by disconnecting from my USB dock while the laptop is suspended, and then resuming.

Attached is what I believe to be the relevant bits from dmesg, with `CONFIG_PROVE_LOCKING=y`.

I've observed this on a range of kernels, including (Ubuntu's fork of) 6.5.13 and a vanilla 6.8.
Comment 1 Takashi Iwai 2024-05-08 07:02:49 UTC
Could you try the patch below?
Comment 2 Takashi Iwai 2024-05-08 07:03:58 UTC
Created attachment 306273 [details]
Test fix patch
Comment 3 Takashi Iwai 2024-05-08 07:58:05 UTC
And I think the second wake_up_all() call is superfluous and can be dropped.
But let's check whether it really addresses the problem or not at first.
Comment 4 Takashi Iwai 2024-05-10 10:18:54 UTC
OK, I could reproduce the problem by inserting an artificial delay at disconnect, and confirmed that the patch worked.

The upstream submission:
  https://lore.kernel.org/all/20240510101424.6279-1-tiwai@suse.de/

It'll be included in 6.10-rc1, backported to stable tree eventually later.

Feel free to reopen if the problem still persists with the patch above.  Thanks.
Comment 5 Richard van der Hoff 2024-05-12 21:29:37 UTC
Thanks very much for investigating! It is my intention to try the patch; I've just not had time yet.
Comment 6 Richard van der Hoff 2024-05-15 06:01:06 UTC
It does indeed look like the patch posted to linux-sound fixes the problem. Thanks again!

Note You need to log in before you can comment on or make changes to this bug.