From owner-cvs-all@FreeBSD.ORG Tue Dec 28 07:21:30 2004 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0DEEB16A4CE; Tue, 28 Dec 2004 07:21:30 +0000 (GMT) Received: from cs.rice.edu (cs.rice.edu [128.42.1.30]) by mx1.FreeBSD.org (Postfix) with ESMTP id C4CF643D45; Tue, 28 Dec 2004 07:21:29 +0000 (GMT) (envelope-from alc@cs.rice.edu) Received: from localhost (calypso.cs.rice.edu [128.42.1.127]) by cs.rice.edu (Postfix) with ESMTP id DD5484AA01; Tue, 28 Dec 2004 01:21:28 -0600 (CST) Received: from cs.rice.edu ([128.42.1.30]) by localhost (calypso.cs.rice.edu [128.42.1.127]) (amavisd-new, port 10024) with LMTP id 28224-01-84; Tue, 28 Dec 2004 01:21:28 -0600 (CST) Received: from noel.cs.rice.edu (noel.cs.rice.edu [128.42.1.136]) by cs.rice.edu (Postfix) with ESMTP id 5811D4AA00; Tue, 28 Dec 2004 01:21:28 -0600 (CST) Received: (from alc@localhost) by noel.cs.rice.edu (8.12.10+Sun/8.12.9/Submit) id iBS7L3Vv017782; Tue, 28 Dec 2004 01:21:03 -0600 (CST) Date: Tue, 28 Dec 2004 01:21:03 -0600 From: Alan Cox To: Darren Reed Message-ID: <20041228072103.GH15591@noel.cs.rice.edu> References: <20041226165927.GA18879@hub.freebsd.org> <20041226182537.GB20920@hub.freebsd.org> <20041226.222435.52824948.imp@bsdimp.com> <20041227054931.GC20920@hub.freebsd.org> <20041227204846.GC15591@noel.cs.rice.edu> <20041228031707.GA38011@hub.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20041228031707.GA38011@hub.freebsd.org> User-Agent: Mutt/1.3.28i X-Virus-Scanned: by amavis-20030616-p7 at cs.rice.edu cc: src-committers@freebsd.org cc: Alan Cox cc: scottl@freebsd.org cc: cvs-all@freebsd.org cc: cvs-src@freebsd.org cc: darrenr@freebsd.org cc: bzeeb-lists@lists.zabbadoz.net cc: "M. Warner Losh" Subject: Re: cvs commit: src/sys/contrib/ipfilter/netinet ip_auth.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Dec 2004 07:21:30 -0000 On Tue, Dec 28, 2004 at 03:17:07AM +0000, Darren Reed wrote: > On Mon, Dec 27, 2004 at 02:48:46PM -0600, Alan Cox wrote: > > Darren, > > > > Based upon a quick look at the above URL, I would say that the problem > > is that you are acquiring an sx lock after a mutex is held. > > Yes, that is what I thought the problem was too. > > > That is not allowed. > > Well, it should be. > [snip] > > What can I say that I haven't already ? > This is a nonsense rule and I'm quite happy that it isn't enforced at > all. The assumption by someone that all of these scenarios lead to > deadlocks is false. Deadlock is not the issue. The implementations of mutex and sx locks don't support the acquisition of mutexes before sx locks. Roughly speaking, when a thread is blocked during the acquisition of a held sx lock, it blocks in a manner similar to tsleep(). For the same reasons that you can't hold a mutex across a tsleep(), you can't hold a mutex when acquiring an sx lock. Yes, it would be nice to have a variant of sx locks that didn't have this restriction, but that is not what we have today. Witness is simply enforcing the restrictions imposed by the existing implementation. Alan