From owner-freebsd-multimedia@FreeBSD.ORG Mon Jun 19 11:46:46 2006 Return-Path: X-Original-To: freebsd-multimedia@freebsd.org Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B813E16A47A for ; Mon, 19 Jun 2006 11:46:46 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from mail48.e.nsc.no (mail48.e.nsc.no [193.213.115.48]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3982A43D45 for ; Mon, 19 Jun 2006 11:46:46 +0000 (GMT) (envelope-from hselasky@c2i.net) Received: from Unknown-00-c0-9f-49-78-d8.lan (ti131310a080-6417.bb.online.no [85.165.217.17]) by mail48.nsc.no (8.13.6/8.13.5) with ESMTP id k5JBkhKa009689 for ; Mon, 19 Jun 2006 13:46:44 +0200 (CEST) From: Hans Petter Selasky To: freebsd-multimedia@freebsd.org Date: Mon, 19 Jun 2006 13:46:48 +0200 User-Agent: KMail/1.7 MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <200606191346.48853.hselasky@c2i.net> Subject: Complaints about the sound system with regard to USB X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Jun 2006 11:46:46 -0000 Hi, I have some complaints about the sound system with regard to USB. 1) If you are playing sound, and unplug the sound device, the system is going to come down with a panic, hence "pcm_unregister()" returns EBUSY, and that is not allowed when a USB device is detached. 2) The locking system is not right. Why must the sound device driver unlock its private lock before calling "chn_intr()" ? I see why, because else you get a dead lock: if (ch->run) { ICH_UNLOCK(sc); chn_intr(ch->channel); ICH_LOCK(sc); } Solution: 1) It is not impossible to kill opened devices at detach. 2) Please use only one lock per "sound-controller". All "child" structures should be protected by this lock, PCM, MIDI, whatever. And when you call up, lock this lock before doing the call, ala CHN_LOCK(). And when you call down, this lock should already be locked. /*---------------------------------------------------------------------------* * pcm_controller_allocate * * NOTE: all sub-controllers are under the same lock! *---------------------------------------------------------------------------*/ struct pcm_controller * pcm_controller_allocate(u_int8_t portable, u_int8_t sub_controllers) Any comments? --HPS