From owner-freebsd-current@FreeBSD.ORG Tue Feb 24 07:57:19 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 B8C8116A4D0 for ; Tue, 24 Feb 2004 07:57:19 -0800 (PST) Received: from mail3.speakeasy.net (mail3.speakeasy.net [216.254.0.203]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8E72043D2D for ; Tue, 24 Feb 2004 07:57:19 -0800 (PST) (envelope-from jhb@FreeBSD.org) Received: (qmail 17881 invoked from network); 24 Feb 2004 15:57:19 -0000 Received: from dsl027-160-063.atl1.dsl.speakeasy.net (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) encrypted SMTP for ; 24 Feb 2004 15:57:19 -0000 Received: from 10.50.40.205 (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.10/8.12.10) with ESMTP id i1OFvF28037467; Tue, 24 Feb 2004 10:57:15 -0500 (EST) (envelope-from jhb@FreeBSD.org) From: John Baldwin To: Don Lewis Date: Tue, 24 Feb 2004 10:58:39 -0500 User-Agent: KMail/1.6 References: <200402241552.i1OFqB7E074413@gw.catspoiler.org> In-Reply-To: <200402241552.i1OFqB7E074413@gw.catspoiler.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200402241058.39196.jhb@FreeBSD.org> X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on server.baldwin.cx cc: kuriyama@imgsrc.co.jp cc: freebsd-current@FreeBSD.org cc: current@FreeBSD.org cc: mat@cnd.mcgill.ca cc: cg@FreeBSD.org Subject: Re: exclusive sleep mutex pcm0 (sound cdev) r = 0 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: Tue, 24 Feb 2004 15:57:19 -0000 On Tuesday 24 February 2004 10:52 am, Don Lewis wrote: > On 24 Feb, John Baldwin wrote: > > On Tuesday 24 February 2004 10:27 am, Don Lewis wrote: > >> I currently have some patches for the channel mutexes that are > >> undergoing testing. Once these have been committed, I'll take another > >> look at the "sound cdev" mutex. My current thought is to convert most > >> uses of it to a lockmgr lock. > > > > Eek, why not a sx lock if you must go to a sleepable lock? > > That was my initial thought, but I was scared off by the following > statement in the sx(9) man page: > > A thread may not own a shared lock and an exclusive lock > simultaneously; attempting to do so will result in deadlock. > > My plan is to hold this lock across large portions of the open() and > ioctl() methods (and possibly read() and write() as well). Some of > these may call code outside of my direct control, such as methods in the > hardware specific drivers, as well as things like malloc(). I'm > concerned about causing a deadlock by violating the sx usage rules. It means on the same lock, i.e. you can't try to do sx_slock(&foo) and then do sx_xlock(&foo). You can mix shared/exclusive of different locks ok. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org