From owner-freebsd-current@FreeBSD.ORG Fri Sep 10 20:47:20 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 04F7316A4CE for ; Fri, 10 Sep 2004 20:47:20 +0000 (GMT) Received: from mail3.speakeasy.net (mail3.speakeasy.net [216.254.0.203]) by mx1.FreeBSD.org (Postfix) with ESMTP id AE7D343D4C for ; Fri, 10 Sep 2004 20:47:19 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: (qmail 16533 invoked from network); 10 Sep 2004 20:47:19 -0000 Received: from dsl027-160-063.atl1.dsl.speakeasy.net (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) encrypted SMTP for ; 10 Sep 2004 20:47:18 -0000 Received: from [10.50.40.210] (gw1.twc.weather.com [216.133.140.1]) (authenticated bits=0) by server.baldwin.cx (8.12.11/8.12.11) with ESMTP id i8AKlEF0017736; Fri, 10 Sep 2004 16:47:15 -0400 (EDT) (envelope-from jhb@FreeBSD.org) From: John Baldwin To: Andrew Gallatin Date: Fri, 10 Sep 2004 16:29:32 -0400 User-Agent: KMail/1.6.2 References: <16705.57806.550902.483858@grasshopper.cs.duke.edu> <200409101450.47478.jhb@FreeBSD.org> <16706.309.398789.905433@grasshopper.cs.duke.edu> In-Reply-To: <16706.309.398789.905433@grasshopper.cs.duke.edu> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200409101629.32653.jhb@FreeBSD.org> X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on server.baldwin.cx cc: John-Mark Gurney cc: freebsd-current@FreeBSD.org Subject: Re: witness oddity X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2004 20:47:20 -0000 On Friday 10 September 2004 03:32 pm, Andrew Gallatin wrote: > John Baldwin writes: > > On Friday 10 September 2004 02:18 pm, Andrew Gallatin wrote: > > > John-Mark Gurney writes: > > > > Andrew Gallatin wrote this message on Fri, Sep 10, 2004 at 13:18 -0400: > > > > > If I call copyout() holding one of my mutexes, it will always > > > > > complain about a LOR, even if the mutex is freshly initiated: > > > > > > > > Calling copyout while holding a mutex is not allowed... If the > > > > page isn't in memory, it could take many seconds for the page to be > > > > swapped back in during which time your mutex will continue to be > > > > held. > > > > > > Thanks.. but that's not really what I asked. > > > > > > I want to know how witness detects a particular just-created mutex as > > > being in a deadlock with the vm map lock. > > > > > > Again, is it because the vm lock is an sx lock? Is there an implicit > > > rule that you can't take an sx lock while holding a mutex (just like > > > you can't take Giant, or sleep?) > > > > Yes. An sx lock is allowed to be held across a sleep, so if you block > > on an sx lock, the owner of the lock you are waiting on might be asleep. > > If that > > Do you agree that the message that Witness emits ("lock order > reversal") for this problem is, while technically accurate, is at > least a little confusing? Before I thought to try the > mtx_init()/mtx_lock/()/copyout() trick, I spent quite a while scanning > my code, looking for some way the VM system could call into it and > acquire that lock. There aren't any. > > Does witness know at the time that it emits the warning that its a > "class" type of reversal, rather than a reversal based on previous > observations? If so, would it be possible to emit a warning saying > something like "Holding a sleep mutex while acquiring an sx lock is > probited by law" (maybe add " violators will be shot" for grins ;) That's a possibility yes. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org