From jylefort@brutele.be  Sun Feb 16 10:51:21 2003
Return-Path: <jylefort@brutele.be>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 623FC37B401
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 16 Feb 2003 10:51:21 -0800 (PST)
Received: from gateway.lefort.net (213.189.162.78.brutele.be [213.189.162.78])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 0EEC543F75
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 16 Feb 2003 10:51:20 -0800 (PST)
	(envelope-from jylefort@brutele.be)
Received: from jsite.lefort.net (jsite.lefort.net [192.168.1.2])
	by gateway.lefort.net (Postfix) with ESMTP id 768C754E5
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 16 Feb 2003 19:51:17 +0100 (CET)
Received: by jsite.lefort.net (Postfix, from userid 1000)
	id 47EE922E35; Sun, 16 Feb 2003 19:51:17 +0100 (CET)
Message-Id: <20030216185117.47EE922E35@jsite.lefort.net>
Date: Sun, 16 Feb 2003 19:51:17 +0100 (CET)
From: Jean-Yves Lefort <jylefort@brutele.be>
Reply-To: Jean-Yves Lefort <jylefort@brutele.be>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: pcm audio driver hogs /dev/dsp?.?
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         48338
>Category:       kern
>Synopsis:       [sound] pcm audio driver hogs /dev/dsp?.?
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-multimedia
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Feb 16 11:00:03 PST 2003
>Closed-Date:    Wed Dec 28 19:17:23 GMT 2005
>Last-Modified:  Wed Dec 28 19:17:23 GMT 2005
>Originator:     Jean-Yves Lefort
>Release:        FreeBSD 4.7-RELEASE-p3 i386
>Organization:
>Environment:
The problem has been experienced on:

$ uname -a
FreeBSD jsite.lefort.net 4.7-RELEASE-p3 FreeBSD 4.7-RELEASE-p3 #0: Tue Jan  7 23:46:56 CET 2003     jylefort@jsite.lefort.net:/usr/obj/usr/src/sys/JSITE  i386
$ cat /dev/sndstat
FreeBSD Audio Driver (newpcm)
Installed devices:
pcm0: <AudioPCI ES1373-8> at io 0x9000 irq 11 (1p/1r/4v channels duplex)
$

and:

$ uname -a
FreeBSD noname 5.0-CURRENT FreeBSD 5.0-CURRENT #1: Sat Feb  1 00:57:38 EST 2003 refugee@noname:/usr/obj/usr/src/sys/NONAME  i386
$ cat /dev/sndstat
FreeBSD Audio Driver (newpcm)
Installed devices:
pcm0: <CMedia CMI8738> at io 0xd800 irq 10 (1p/1r/0v channels duplex default)
$

>Description:
Under certain conditions, the pcm audio device driver hogs /dev/dsp?.?
("Device Busy").

It seems that the problem happens when a process tries to open a dsp
device shortly after the same device has been opened by another
process.

This might be related to the vchan code, as the hw.snd.pcm0.vchans
sysctl knob was set to 4 during my tests.

"fstat | grep dsp" gives nothing.

	
>How-To-Repeat:
$ while :; do play somesoundfile & done

This will quickly lock /dev/dsp0.0. Of course, be prepared to hit ^C,
since the & is not a typo. :)
	
>Fix:
If multiple virtual channels are in use when the problem first
appears, setting sysctl hw.snd.pcm0.vchans to locked_dsp_# - 1 and
then back to the original number unlocks the dsp device.

However, after locking the dsp device a second time, reducing
hw.snd.pcm0.vchans gives "Invalid argument" and the device is locked
for good: then, only a reboot helps.
	
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->sound 
Responsible-Changed-By: kris 
Responsible-Changed-When: Sat Jul 12 21:50:49 PDT 2003 
Responsible-Changed-Why:  
Over to sound maintainers 

http://www.freebsd.org/cgi/query-pr.cgi?pr=48338 

From: Jean-Yves Lefort <jylefort@brutele.be>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: kern/48338: [sound] pcm audio driver hogs /dev/dsp?.?
Date: Tue, 28 Sep 2004 05:23:37 +0200

 Updating from 4.10 to 5.3-BETA6 fixed the problem.
 
 -- 
 Jean-Yves Lefort
 
 jylefort@brutele.be
 http://lefort.be.eu.org/

From: Jean-Yves Lefort <jylefort@brutele.be>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: kern/48338: [sound] pcm audio driver hogs /dev/dsp?.?
Date: Thu, 14 Oct 2004 00:13:32 +0200

 Update: actually, the problem is still there even with 5.X, but is not
 reproducible using the above command.
State-Changed-From-To: open->feedback 
State-Changed-By: netchild 
State-Changed-When: Sun Sep 11 14:18:06 GMT 2005 
State-Changed-Why:  
Do you still have this problem with a recent -current? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=48338 

From: Jean-Yves Lefort <jylefort@FreeBSD.org>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/48338: [sound] pcm audio driver hogs /dev/dsp?.?
Date: Sun, 11 Sep 2005 17:37:33 +0200

 --Signature=_Sun__11_Sep_2005_17_37_33_+0200_mHpYMj+.thMAtyev
 Content-Type: text/plain; charset=US-ASCII
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable
 
 Yes:
 
 $ while :; do play -d /dev/dsp0.1 somesound.wav & done
 ...
 ^C
 
 $ play -d /dev/dsp0.1 somesound.wav
 sox: Can't open output file '/dev/dsp0.1': Device busy
 
 $ fstat | grep dsp
 $
 
 --=20
 Jean-Yves Lefort
 
 jylefort@FreeBSD.org
 http://lefort.be.eu.org/
 
 --Signature=_Sun__11_Sep_2005_17_37_33_+0200_mHpYMj+.thMAtyev
 Content-Type: application/pgp-signature
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.1 (FreeBSD)
 
 iD8DBQFDJE89yzD7UaO4AGoRAlzQAJ40DNbBi3q11V2LxzIEpPAvxGnI1wCfdq6H
 0sLz2bObZjNrxz8U/7sh6Zw=
 =YLSk
 -----END PGP SIGNATURE-----
 
 --Signature=_Sun__11_Sep_2005_17_37_33_+0200_mHpYMj+.thMAtyev--

From: Jean-Yves Lefort <jylefort@FreeBSD.org>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/48338: [sound] pcm audio driver hogs /dev/dsp?.?
Date: Sun, 11 Sep 2005 17:53:20 +0200

 --Signature=_Sun__11_Sep_2005_17_53_20_+0200_xHqtIZNKXld3tY6w
 Content-Type: text/plain; charset=US-ASCII
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable
 
 I forgot to mention that I'm using 5.4-RELEASE, not a recent -current.
 
 --=20
 Jean-Yves Lefort
 
 jylefort@FreeBSD.org
 http://lefort.be.eu.org/
 
 --Signature=_Sun__11_Sep_2005_17_53_20_+0200_xHqtIZNKXld3tY6w
 Content-Type: application/pgp-signature
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.1 (FreeBSD)
 
 iD8DBQFDJFLwyzD7UaO4AGoRAuRoAJwMbiVGPH82qcLjjw+sDvxxldqLGwCfajFA
 jVDfg/H8d5bjMZSbm3RlfC8=
 =xitU
 -----END PGP SIGNATURE-----
 
 --Signature=_Sun__11_Sep_2005_17_53_20_+0200_xHqtIZNKXld3tY6w--

From: Ariff Abdullah <skywizard@MyBSD.org.my>
To: Jean-Yves Lefort <jylefort@FreeBSD.org>
Cc: bug-followup@FreeBSD.org
Subject: Re: kern/48338: [sound] pcm audio driver hogs /dev/dsp?.?
Date: Mon, 12 Sep 2005 00:16:12 +0800

 On Sun, 11 Sep 2005 16:00:43 GMT
 Jean-Yves Lefort <jylefort@FreeBSD.org> wrote:
 > The following reply was made to PR kern/48338; it has been noted by
 > GNATS.
 > 
 > From: Jean-Yves Lefort <jylefort@FreeBSD.org>
 > To: bug-followup@FreeBSD.org
 > Cc:  
 > Subject: Re: kern/48338: [sound] pcm audio driver hogs /dev/dsp?.?
 > Date: Sun, 11 Sep 2005 17:53:20 +0200
 > 
 >  
 >  I forgot to mention that I'm using 5.4-RELEASE, not a recent
 >  -current.
 >  
 Even after applying
 http://staff.mybsd.org.my/skywizard/FreeBSD/sound/snd_RELENG_5_20050825_035.diff
 ?
 
 
 --
 
 Ariff Abdullah
 MyBSD
 
 http://www.MyBSD.org.my (IPv6/IPv4)
 http://staff.MyBSD.org.my (IPv6/IPv4)
 http://tomoyo.MyBSD.org.my (IPv6/IPv4)
State-Changed-From-To: feedback->open 
State-Changed-By: netchild 
State-Changed-When: Mon Sep 12 18:38:03 GMT 2005 
State-Changed-Why:  
Feedback received, it's still a problem, so back to "open". 

http://www.freebsd.org/cgi/query-pr.cgi?pr=48338 

From: Ariff Abdullah <skywizard@MyBSD.org.my>
To: bug-followup@FreeBSD.org
Cc: jylefort@brutele.be, netchild@FreeBSD.org
Subject: Re: kern/48338: [sound] pcm audio driver hogs /dev/dsp?.?
Date: Fri, 16 Sep 2005 08:06:36 +0800

 On Mon, 12 Sep 2005 18:38:41 GMT
 Alexander Leidinger <netchild@FreeBSD.org> wrote:
 > Synopsis: [sound] pcm audio driver hogs /dev/dsp?.?
 > 
 > State-Changed-From-To: feedback->open
 > State-Changed-By: netchild
 > State-Changed-When: Mon Sep 12 18:38:03 GMT 2005
 > State-Changed-Why: 
 > Feedback received, it's still a problem, so back to "open".
 > 
 I cannot reproduce this, but then again, my src is no longer a pristine
 RELENG_5.
 
 First of all, using /dev/dsp0.<channel number> is discourage, because
 that means you're locking it to certain virtual channel. Since:
 
 # Note: you're sending this to background that will keep it running
 # even after ctrl+c
 $ while : ; do play -d /dev/dsp0.1 somefile & ; done
 ^C
 $ play -d /dev/dsp0.1 somefile
 
 In this case, trying to use already occupied dsp device will obviously
 fail (device busy). Use /dev/dsp instead for dynamic channel allocation.
 
 I would suggest you to try first those proposed patch (for RELENG_5).
 Most of the fixes already commited to HEAD.
 
 http://staff.mybsd.org.my/skywizard/FreeBSD/sound/
 
 If the problem still persist (even after applying it), could you please
 tell us what soundcard you have, pciconf -lv, sysctl hw.snd, cat
 /dev/sndstat , anything that might be related.
 
 --
 
 Ariff Abdullah
 MyBSD
 
 http://www.MyBSD.org.my (IPv6/IPv4)
 http://staff.MyBSD.org.my (IPv6/IPv4)
 http://tomoyo.MyBSD.org.my (IPv6/IPv4)
State-Changed-From-To: open->closed 
State-Changed-By: netchild 
State-Changed-When: Wed Dec 28 19:15:58 UTC 2005 
State-Changed-Why:  
Timeout:	>3 months without feedback 

Additionally we belive it's fixed in -current. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=48338 
>Unformatted:
