From nobody Tue Jan 16 14:52:27 2024 X-Original-To: freebsd-multimedia@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TDsS65RBPz57Mvb for ; Tue, 16 Jan 2024 14:52:38 +0000 (UTC) (envelope-from christos@freebsd.org) Received: from margiolis.net (mail.margiolis.net [95.179.159.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA512) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4TDsS529Jnz4LH9; Tue, 16 Jan 2024 14:52:37 +0000 (UTC) (envelope-from christos@freebsd.org) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=margiolis.net header.s=mail header.b=C6nrDiDb; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=freebsd.org (policy=none); spf=softfail (mx1.freebsd.org: 95.179.159.8 is neither permitted nor denied by domain of christos@freebsd.org) smtp.mailfrom=christos@freebsd.org DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=mail; bh=mWP1oIIUXceXXc1 qYtaH+2hTMHEh7zmW/o5q5H506Qk=; h=subject:cc:to:from:date; d=margiolis.net; b=C6nrDiDbvZrrULMQP1nV8nwvDS9I+4c+0C875R/4zFDGTh6o+eW IDGyJTkwxeaSrO31sdPEwooGzmc/Sk8gpZ1pbtAfXA9a4AGfGmh2nlzBEDssdP/8JLeIpy jw3aopC1M8rmx4LwceUDeqn1xMQOvkIQ0fiJ5y0IQFJawFc6uY= Received: from tpad (ppp-94-66-59-192.home.otenet.gr [94.66.59.192]) by margiolis.net (OpenSMTPD) with ESMTPSA id 1d84142d (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Tue, 16 Jan 2024 14:52:29 +0000 (UTC) Date: Tue, 16 Jan 2024 16:52:27 +0200 From: Christos Margiolis To: status-updates@freebsdfoundation.org Cc: freebsd-multimedia@freebsd.org, markj@freebsd.org, jrm@freebsd.org Subject: [Development report #2] Audio Stack Improvements Message-ID: List-Id: Multimedia discussions List-Archive: https://lists.freebsd.org/archives/freebsd-multimedia List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-multimedia@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Spamd-Bar: -- X-Spamd-Result: default: False [-2.70 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.997]; MID_RHS_NOT_FQDN(0.50)[]; R_DKIM_ALLOW(-0.20)[margiolis.net:s=mail]; DMARC_POLICY_SOFTFAIL(0.10)[freebsd.org : No valid SPF, DKIM not aligned (relaxed),none]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RCVD_COUNT_ONE(0.00)[1]; FREEFALL_USER(0.00)[christos]; MISSING_XM_UA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:20473, ipnet:95.179.144.0/20, country:US]; RCVD_TLS_ALL(0.00)[]; MLMMJ_DEST(0.00)[freebsd-multimedia@freebsd.org]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_SOFTFAIL(0.00)[~all:c]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_NONE(0.00)[]; DKIM_TRACE(0.00)[margiolis.net:+] X-Rspamd-Queue-Id: 4TDsS529Jnz4LH9 Hello, Last week's report: Trying various different approaches to solving https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=194727 While it’s no longer the case that the USB stack completely hangs endlessly, the existing code makes the channel belonging to the detached USB device go to sleep for hw.snd.timeout seconds and manually kills it after the timeout, effectively terminating the read/write operation. What we really want in the case of a hot-unplug, however, is to kill the channel immediately without waiting. We could set the timeout to 1 second, but this is still not ideal. Upon detach, pcm_unregister() sets an SD_F_DETACHING flag, and, while it should theoretically be easy to simply add a `if (PCM_DETACHING(dev))` at the beginning of chn_read() and chn_write() and kill the channel if the case is true, the channel goes to sleep before the detach routine is called. I suspect that if we somehow get around this issue, then the bug will be fixed. Other things I tried included manually freeing up resources and destroying the device’s devfs nodes, and while this seemed like it worked, the channel had again already gone to sleep. Suggestions and ideas are all welcome! Worked with imp@, emaste@ and markj@ to finalize the patches mentioned in last week’s report. Simplified device_set_usb_desc() by calling only usb_devinfo() to set the device's description and removing the first attempt to fetch the description through the iInterface descriptor, which 1) is not present in many devices and 2) usually includes less information. https://reviews.freebsd.org/D43383 Wrote a few more new minor patches: https://reviews.freebsd.org/D43394 https://reviews.freebsd.org/D43396 https://reviews.freebsd.org/D43397 Christos