From owner-freebsd-current@FreeBSD.ORG Sat Jan 24 13:19:48 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DCF9A16A4CE for ; Sat, 24 Jan 2004 13:19:48 -0800 (PST) Received: from gw.catspoiler.org (217-ip-163.nccn.net [209.79.217.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9A71F43D4C for ; Sat, 24 Jan 2004 13:18:46 -0800 (PST) (envelope-from truckman@FreeBSD.org) Received: from FreeBSD.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.12.9p2/8.12.9) with ESMTP id i0OLI47E073265; Sat, 24 Jan 2004 13:18:08 -0800 (PST) (envelope-from truckman@FreeBSD.org) Message-Id: <200401242118.i0OLI47E073265@gw.catspoiler.org> Date: Sat, 24 Jan 2004 13:18:04 -0800 (PST) From: Don Lewis To: shoesoft@gmx.net In-Reply-To: <1074978522.690.12.camel@shoeserv.freebsd> MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii cc: current@FreeBSD.org cc: mat@cnd.mcgill.ca Subject: Re: write(2) lc_r problem X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Jan 2004 21:19:49 -0000 On 24 Jan, Stefan Ehmann wrote: > On Sat, 2004-01-24 at 21:03, Mathew Kanner wrote: >> On Jan 24, Stefan Ehmann wrote: >> > On Sat, 2004-01-24 at 20:15, Mathew Kanner wrote: >> > > On Jan 24, Stefan Ehmann wrote: >> > > > I'm trying to write a small sound application and run across a problem >> > > > on CURRENT. >> > > > >> > > > It's very basic at the moment. It simply reads pcm data from a file and >> > > > uses write(2) on /dev/dsp. >> > > > >> > > > But as soon as I link the program with -lc_r there's always about 1 >> > > > second delay before a write call - which makes it pretty unusable for >> > > > playing sound. >> > > > >> > > > It should be easy reproducable if you link audio/waveplay with -lc_r. >> > > > >> > > > This doesn't happen in either FreeBSD 4.9, Knoppix or CURRENT if linked >> > > > with -lkse or -lthr. >> > > > >> > > > Am I'm missing something basic when using write together with lc_r or >> > > > ist this a bug in CURRENT? >> > > >> > > There is definetly a bug with the sound code when using vchans >> > > and select. Make sure that (using sysctl) >> > > >> > > hw.snd.maxautovchans=0 >> > > hw.snd.pcmX.vchans=0 >> > >> > You're right, that fixed it. That's also the reason why it worked on >> > stable (vchans was disabled there). >> >> Please try this untested patch with vchans enabled. >> > > Great, now it also works with vchans enabled. > > I'm also testing a pcm patch by truckman@ at the moment. Unfortunately > those two combined don't run nicely. > > Panicstring: mutex pcm0:virtual:0 not owned at /usr/src/sys/dev/sound/pcm/channel.c:90 Uncomment the CHN_LOCKASSERT(c) in chn_wakeup, and bracket the chn_wakeup() call in the SLIST_FOREACH() loop with CHN_LOCK(pce->channel); CHN_UNLOCK(pce->channel);