Date: Tue, 12 Aug 2003 21:24:40 +1000 From: Peter Jeremy <PeterJeremy@optushome.com.au> To: Ted Unangst <tedu@stanford.edu> Cc: freebsd-hackers@freebsd.org Subject: Re: possible deadlocks? Message-ID: <20030812112440.GB66788@cirb503493.alcatel.com.au> In-Reply-To: <Pine.GSO.4.44.0308111544090.21112-100000@saga8.Stanford.EDU> References: <XFMail.20030811180315.jhb@FreeBSD.org> <Pine.GSO.4.44.0308111544090.21112-100000@saga8.Stanford.EDU>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Aug 11, 2003 at 03:50:26PM -0700, Ted Unangst wrote: >On Mon, 11 Aug 2003, John Baldwin wrote: >> Also, SK_LOCK != SK_IF_LOCK, or is that a typo? If it is a typo, >> then the lock order should still be fixed in some fashion. > >They are the same. SK_IF_LOCK is called on the sk_if_softc, but just >locks the shared sk_softc mutex. Does that make sense? > >#define SK_LOCK(_sc) mtx_lock(&(_sc)->sk_mtx) >#define SK_IF_LOCK(_sc) mtx_lock(&(_sc)->sk_softc->sk_mtx) This strikes me as a particularly poor selection of macros. They look like they are different locks and I'm sure John won't be the only person who gets caught believing they really are different. Getting locking right is difficult enough without having the same lock called different things in different places. This is an area where C++ would be cleaner - you have two (inline) functions with the same name and the compiler picks the appropriate one based on the argument type. Failing that, I think the code would be cleaner without the macros or with SK_IF_LOCK() references replaced by SK_LOCK(). Peter
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030812112440.GB66788>