From owner-freebsd-current@FreeBSD.ORG Thu Sep 15 04:34:16 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 CBEB016A41F for ; Thu, 15 Sep 2005 04:34:16 +0000 (GMT) (envelope-from pyunyh@gmail.com) Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.202]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3E3B043D48 for ; Thu, 15 Sep 2005 04:34:16 +0000 (GMT) (envelope-from pyunyh@gmail.com) Received: by zproxy.gmail.com with SMTP id j2so22145nzf for ; Wed, 14 Sep 2005 21:34:15 -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=XZOd9zsJfRK53aSXmC14EISYTyQGg6faLH8QlVSRahBqB1AxkLdsvNR1SlGukd4g25oUwmqylbrayYSwEpDcRqOv7kCbgwD0R7O6ckUsob1Wlo00lyTHGb/D5+JvF8rkQX9RyTRzJlRnLhhiRkUU8R5soEfeNtdhqw9PzFpHX8c= Received: by 10.37.13.2 with SMTP id q2mr2923459nzi; Wed, 14 Sep 2005 21:34:15 -0700 (PDT) Received: from michelle.rndsoft.co.kr ( [211.32.202.211]) by mx.gmail.com with ESMTP id 19sm638605nzp.2005.09.14.21.34.13; Wed, 14 Sep 2005 21:34:14 -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 j8F4Ynvm018550 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 15 Sep 2005 13:34:49 +0900 (KST) (envelope-from yongari@gmail.com) Received: (from yongari@localhost) by michelle.rndsoft.co.kr (8.13.1/8.13.1/Submit) id j8F4YmkT018549; Thu, 15 Sep 2005 13:34:48 +0900 (KST) (envelope-from yongari@gmail.com) Date: Thu, 15 Sep 2005 13:34:48 +0900 From: Pyun YongHyeon To: Ariff Abdullah Message-ID: <20050915043448.GB18332@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> <20050915014509.GA17602@rndsoft.co.kr> <20050915114653.431f17c5.skywizard@MyBSD.org.my> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050915114653.431f17c5.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 04:34:16 -0000 On Thu, Sep 15, 2005 at 11:46:53AM +0800, Ariff Abdullah wrote: > On Thu, 15 Sep 2005 10:45:09 +0900 > Pyun YongHyeon wrote: > > > > 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. > > > I tend to agree with you. Since that sndstat_busy() isn't enough, how > about we acquire the entire sndstat so nobody can monkey with it (as the > proposed / attached diff) and at the same time avoiding this LOR > message. It seems much better rather than locking sndstat after > sndstat_busy() and much of pcm_unregister() procedures, only to find out > that somebody acquire it within that moment. > I didn't try the patch but it looks good to me. :-) If you have more time would you please fix race in sndstat_open()? Minor note : I think it is better to use sx_xunlock ranther than sx_unlock as sx_xunlock clearly indicates which type of locks held. -- Regards, Pyun YongHyeon