From owner-freebsd-arch@FreeBSD.ORG Mon Aug 18 11:38:16 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B870937B401 for ; Mon, 18 Aug 2003 11:38:14 -0700 (PDT) Received: from mail.speakeasy.net (mail9.speakeasy.net [216.254.0.209]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1087E43F85 for ; Mon, 18 Aug 2003 11:38:12 -0700 (PDT) (envelope-from jhb@FreeBSD.org) Received: (qmail 24042 invoked from network); 18 Aug 2003 18:38:10 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender )encrypted SMTP for ; 18 Aug 2003 18:38:10 -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 h7IIc79s085638; Mon, 18 Aug 2003 14:38:08 -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: <20030818092434.GB2392@spc.org> Date: Mon, 18 Aug 2003 14:38:31 -0400 (EDT) From: John Baldwin To: Bruce M Simpson cc: arch@freebsd.org cc: Seigo Tanimura Subject: Re: Embedding a vnode type to its interlock mutex type X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Aug 2003 18:38:16 -0000 On 18-Aug-2003 Bruce M Simpson wrote: > On Mon, Aug 18, 2003 at 04:13:26PM +0900, Seigo Tanimura wrote: >> In short: A vnode should embed its type name (VREG, VCHR, etc.) in the >> type of the interlock mutex to avoid a false LOR alarm by Witness. > > I think I may have run into something similar with VM mutexes, but need > to sit down and perform more in-depth testing to be sure about this. > > It does appear as though WITNESS only checks the name of the mutex, not > the address of the mutex, which would presumably be a suitable key to > differentiate them uniquely. This is intentional. Assume I have a lock A and two processes P1 and P2 each with a mutex. Now assume the following code paths: foo(P) { ... lock(A); lock(P->p_mtx); ... } bar(P) { ... lock(P->p_mtx); lock(A) ... } And assume the following is executed: foo(P1) bar(P2) Should that be a lock order reversal? I think it should be, because bar() might be called on P1 later or foo() on P2. If you only use lock addresses, then witness will not catch that reversal. Witness intentionally defines orders between groups of locks. Note that you can provide witness with a different name besides the individual mutex name via the 3rd argument to mtx_init(). See the MTX_NETWORK_LOCK for example which is used as the class for all network driver locks. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/