From owner-freebsd-acpi@FreeBSD.ORG Mon Sep 24 16:28:56 2007 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 03DD616A41A; Mon, 24 Sep 2007 16:28:56 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from speedfactory.net (mail6.speedfactory.net [66.23.216.219]) by mx1.freebsd.org (Postfix) with ESMTP id 9CE6013C494; Mon, 24 Sep 2007 16:28:55 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (unverified [66.23.211.162]) by speedfactory.net (SurgeMail 3.8p) with ESMTP id 211143967-1834499 for multiple; Mon, 24 Sep 2007 12:27:16 -0400 Received: from localhost.corp.yahoo.com (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.13.8/8.13.8) with ESMTP id l8OGSY3q098743; Mon, 24 Sep 2007 12:28:36 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: Nate Lawson Date: Mon, 24 Sep 2007 12:28:33 -0400 User-Agent: KMail/1.9.6 References: <200709181516.11207.jkim@FreeBSD.org> <200709241155.56926.jhb@freebsd.org> <46F7E19B.3010603@root.org> In-Reply-To: <46F7E19B.3010603@root.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200709241228.34162.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Mon, 24 Sep 2007 12:28:36 -0400 (EDT) X-Virus-Scanned: ClamAV 0.88.3/4378/Mon Sep 24 08:25:35 2007 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: freebsd-acpi@freebsd.org, freebsd-current@freebsd.org, Jung-uk Kim Subject: Re: [PATCH] OsdSynch.c modernization X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2007 16:28:56 -0000 On Monday 24 September 2007 12:11:07 pm Nate Lawson wrote: > John Baldwin wrote: > > 2007/9/22, Jung-uk Kim : > >> I thought exactly the same when I started rewriting it (almost half > >> year ago!). I have tried all of the above, spent numerous sleepless > >> nights, and miserably failed. :-( > >> > >> Spin mutex is too restrictive (e.g., it cannot be used with other > >> locks gracefully). critical_enter() causes: > >> > >> panic: blockable sleep lock (sleep mutex) 32 @ > >> /usr/src/sys/vm/uma_core.c:1830 cpuid = 0 > >> KDB: enter: panic > >> [thread pid 21 tid 100013 ] > >> Stopped at kdb_enter+0x32: leave > > > > However, disabling interrupts while you block on other locks is just as bad, > > we just don't assert for it. Better would be to fix ACPI-CA to not try to > > malloc() while holding a spin lock. You should be able to see where it is > > doing that via the stack trace. If the malloc is using M_NOWAIT you will be > > far better off using a plain mutex and just not disabling interrupts. > > For 7.0, we're going with what we have (sx locks) since it's well-tested > and not wrong, maybe just less than optimal. Remember that acpi locks > are acquired a few dozen times every 10 seconds or so, so this is not at > risk of being a performance issue. Disabling interrupts and then calling malloc() is wrong however. -- John Baldwin