From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 12 08:33:24 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8E64E37B401 for ; Tue, 12 Aug 2003 08:33:24 -0700 (PDT) Received: from mail.speakeasy.net (mail15.speakeasy.net [216.254.0.215]) by mx1.FreeBSD.org (Postfix) with ESMTP id DFCF243F85 for ; Tue, 12 Aug 2003 08:33:23 -0700 (PDT) (envelope-from jhb@FreeBSD.org) Received: (qmail 21031 invoked from network); 12 Aug 2003 15:33:23 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender )encrypted SMTP for ; 12 Aug 2003 15:33:23 -0000 Received: from laptop.baldwin.cx (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.9/8.12.9) with ESMTP id h7CFXL9s056478; Tue, 12 Aug 2003 11:33:21 -0400 (EDT) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.5.4 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <20030812112440.GB66788@cirb503493.alcatel.com.au> Date: Tue, 12 Aug 2003 11:33:43 -0400 (EDT) From: John Baldwin To: Peter Jeremy cc: freebsd-hackers@freebsd.org Subject: Re: possible deadlocks? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Aug 2003 15:33:24 -0000 On 12-Aug-2003 Peter Jeremy wrote: > 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(). Definitely agreed. That is gross. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/