Date: Mon, 18 Aug 2003 14:38:31 -0400 (EDT) From: John Baldwin <jhb@FreeBSD.org> To: Bruce M Simpson <bms@spc.org> Cc: Seigo Tanimura <tanimura@tanimura.dyndns.org> Subject: Re: Embedding a vnode type to its interlock mutex type Message-ID: <XFMail.20030818143831.jhb@FreeBSD.org> In-Reply-To: <20030818092434.GB2392@spc.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <jhb@FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.20030818143831.jhb>