Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 03 Jul 2005 00:59:40 -0000
From:      Scott Long <scottl@freebsd.org>
To:        Darren Reed <darrenr@hub.freebsd.org>
Cc:        src-committers@freebsd.org, cvs-src@freebsd.org, Alan Cox <alc@cs.rice.edu>, cvs-all@freebsd.org, darrenr@freebsd.org, bzeeb-lists@lists.zabbadoz.net, "M. Warner Losh" <imp@bsdimp.com>
Subject:   Re: cvs commit: src/sys/contrib/ipfilter/netinet ip_auth.c
Message-ID:  <41D0D580.7090207@freebsd.org>
In-Reply-To: <20041228031707.GA38011@hub.freebsd.org>
References:  <20041226165927.GA18879@hub.freebsd.org> <Pine.BSF.4.53.0412261707210.68472@e0-0.zab2.int.zabbadoz.net> <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>

next in thread | previous in thread | raw e-mail | index | archive | help
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.
> 
> 
>>More generally, an sx lock is termed a "sleepable" lock
>>and a mutex is not; all desired sleepable locks must be acquired
>>before any non-sleepable locks are acquired.  Witness enforces this
>>prohibition, but perhaps causes confusion by calling it a reversal.
> 
> 
> 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.
> 
> I imagine it is part of why things like the IFNET_*LOCK macros use mtx
> rather than sx.  On systems where the interface list is of non-trivial
> size, I imagine this would have a measurable impact.
> 
> Perhaps the most stupid realisation from this has been that IPFilter
> code gets called with a UDP mutex of some sort held.  Like WTF ?
> 
> Darren

The locking APIs have existed in FreeBSD 5.x for 4 years.  They are 
documented in manual pages, web pages, and publically available USENIX
papers.  Just because you don't agree that sx locks should be sleepable
doesn't mean that your opinion is valid.  Also, there is already another
network filter package that is locked, locked correctly, and performs
well.  You are not treading into new waters here.  We can debate the
observation that you hold that there is a UDP lock held, but calling it 
outright stupid doesn't help your case.

Scott




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?41D0D580.7090207>