[Bug 194727] uaudio device gets disconnected, and hangs usb until everything using /dev/mixer* is closed
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 31 Mar 2024 14:17:00 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=194727
--- Comment #89 from commit-hook@FreeBSD.org ---
A commit in branch main references this bug:
URL:
https://cgit.FreeBSD.org/src/commit/?id=9eff58c6d52b66eb8abe7f724dabcd804a566df4
commit 9eff58c6d52b66eb8abe7f724dabcd804a566df4
Author: Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2024-03-31 14:13:43 +0000
Commit: Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2024-03-31 14:13:43 +0000
sound: Implement asynchronous device detach
Hot-unplugging a sound device, such as a USB sound card, whilst being
consumed by an application, results in an infinite loop until either the
application closes the device's file descriptor, or the channel
automatically times out after hw.snd.timeout seconds. In the case of a
detach however, the timeout approach is still not ideal, since we want
all resources to be released immediatelly, without waiting for N seconds
until we can use the bus again.
The timeout mechanism works by calling chn_sleep() in chn_read() and
chn_write() (see pcm/channel.c) in order to send the thread to sleep,
using cv_timedwait_sig(). Since chn_sleep() sets the CHN_F_SLEEPING flag
while waiting for cv_timedwait_sig() to return, we can test this flag in
pcm_unregister() (called during detach) and wakeup the sleeping
thread(s) to immediately kill the channel(s) being consumed.
Sponsored by: The FreeBSD Foundation
MFC after: 2 months
PR: 194727, 278055, 202275, 220949, 272286
Reviewed by: dev_submerge.ch, markj
Differential Revision: https://reviews.freebsd.org/D43545
share/man/man4/snd_uaudio.4 | 11 +----------
sys/dev/sound/pcm/dsp.c | 2 +-
sys/dev/sound/pcm/mixer.c | 11 -----------
sys/dev/sound/pcm/sound.c | 24 ++++++++++--------------
sys/dev/sound/usb/uaudio.c | 13 +++----------
5 files changed, 15 insertions(+), 46 deletions(-)
--
You are receiving this mail because:
You are the assignee for the bug.