From owner-freebsd-current@FreeBSD.ORG Thu Sep 15 01:44:38 2005 Return-Path: X-Original-To: freebsd-current@freebsd.org 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 08F9016A41F for ; Thu, 15 Sep 2005 01:44:38 +0000 (GMT) (envelope-from pyunyh@gmail.com) Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.193]) by mx1.FreeBSD.org (Postfix) with ESMTP id E189643D5A for ; Thu, 15 Sep 2005 01:44:36 +0000 (GMT) (envelope-from pyunyh@gmail.com) Received: by zproxy.gmail.com with SMTP id j2so120759nzf for ; Wed, 14 Sep 2005 18:44:36 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:date:from:to:cc:subject:message-id:reply-to:references:mime-version:content-type:content-disposition:in-reply-to:user-agent; b=a4C4pjS/u3hzoBuXsUDSfUNhzjyfaM44VNsGUMieepJKMM7RQafJ/ANznUF+WR4ygOXzvRzkMSQyr/k52walApHHcYL2xrGb3gnnQc+k6l0rDKaIIQkR8LooHMMVnSgbNlZeVby31gbY/UM0LEq3YfIjJM7t01w4ZHDt3iA00KQ= Received: by 10.37.13.2 with SMTP id q2mr2783632nzi; Wed, 14 Sep 2005 18:44:36 -0700 (PDT) Received: from michelle.rndsoft.co.kr ( [211.32.202.211]) by mx.gmail.com with ESMTP id 15sm487505nzo.2005.09.14.18.44.34; Wed, 14 Sep 2005 18:44:36 -0700 (PDT) Received: from michelle.rndsoft.co.kr (localhost.rndsoft.co.kr [127.0.0.1]) by michelle.rndsoft.co.kr (8.13.1/8.13.1) with ESMTP id j8F1jAJ2017983 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 15 Sep 2005 10:45:10 +0900 (KST) (envelope-from yongari@rndsoft.co.kr) Received: (from yongari@localhost) by michelle.rndsoft.co.kr (8.13.1/8.13.1/Submit) id j8F1j9UW017982; Thu, 15 Sep 2005 10:45:09 +0900 (KST) (envelope-from yongari@rndsoft.co.kr) Date: Thu, 15 Sep 2005 10:45:09 +0900 From: Pyun YongHyeon To: Ariff Abdullah Message-ID: <20050915014509.GA17602@rndsoft.co.kr> References: <47d0403c05091121047a037946@mail.gmail.com> <20050912044212.GC5182@rndsoft.co.kr> <47d0403c05091122276fd0a231@mail.gmail.com> <20050913070149.GE9481@rndsoft.co.kr> <47d0403c0509131235ed58122@mail.gmail.com> <20050914014830.GA13631@rndsoft.co.kr> <20050915033848.2d87da42.skywizard@MyBSD.org.my> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050915033848.2d87da42.skywizard@MyBSD.org.my> User-Agent: Mutt/1.4.2.1i Cc: freebsd-current@freebsd.org, minimarmot@gmail.com Subject: Re: panic upon kldunload snd_ich (lor # 159) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pyunyh@gmail.com List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2005 01:44:38 -0000 On Thu, Sep 15, 2005 at 03:38:48AM +0800, Ariff Abdullah wrote: > > On Wed, 14 Sep 2005 10:48:30 +0900 > Pyun YongHyeon wrote: > > > > Thanks for testing. Fix committed to HEAD(sndstat.c rev. 1.21) > > > > [ .. ] > > > > AFAIK, the LOR is well known to sound developers. Though it's not real > > LOR(grabbing sx lock while holding mutex) it's difficult to fix. > > > > This is supposed to fix that LOR, I pressume. Please try that. > [...] > --- sys/dev/sound/pcm/sound.c.orig Tue Sep 13 02:58:27 2005 > +++ sys/dev/sound/pcm/sound.c Thu Sep 15 03:29:06 2005 > @@ -807,9 +807,9 @@ > chn_kill(d->fakechan); > fkchan_kill(d->fakechan); > > - sndstat_unregister(dev); > snd_mtxunlock(d->lock); > snd_mtxfree(d->lock); > + sndstat_unregister(dev); > return 0; > } > That would be supposed to fix the LOR message. But I'd like to keep lock ordering between snd_mutex and sndstat_lock. Since sndstat_read() could be called at any time there is an implicit lock order. I think switching to sx lock from mutex in sndstat code was to allow uiomove with lock held. IMO, it would be even better to rewrite sndstat_read() without using uiomove such that it can also use standard mutex rather than sx lock. -- Regards, Pyun YongHyeon