From owner-freebsd-acpi@FreeBSD.ORG Mon Sep 24 16:59:05 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 1AB3716A419; Mon, 24 Sep 2007 16:59:05 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from anuket.mj.niksun.com (gwnew.niksun.com [65.115.46.162]) by mx1.freebsd.org (Postfix) with ESMTP id B97FA13C45D; Mon, 24 Sep 2007 16:59:04 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from niksun.com (anuket [10.70.0.5]) by anuket.mj.niksun.com (8.13.6/8.13.6) with ESMTP id l8OGx2I8001148; Mon, 24 Sep 2007 12:59:03 -0400 (EDT) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: freebsd-acpi@FreeBSD.org Date: Mon, 24 Sep 2007 12:58:54 -0400 User-Agent: KMail/1.6.2 References: <200709181516.11207.jkim@FreeBSD.org> <46F7E19B.3010603@root.org> <200709241228.34162.jhb@freebsd.org> In-Reply-To: <200709241228.34162.jhb@freebsd.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200709241259.01518.jkim@FreeBSD.org> X-Virus-Scanned: ClamAV 0.90.2/4378/Mon Sep 24 08:25:35 2007 on anuket.mj.niksun.com X-Virus-Status: Clean Cc: freebsd-current@FreeBSD.org, John Baldwin 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:59:05 -0000 On Monday 24 September 2007 12:28 pm, John Baldwin wrote: > 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. Understood. As I said earlier, I really like to fix it correctly. However, the problem is that there are so many different BIOSes out there, taking so different code paths. Whenever I thought it's fixed, someone says 'you broke my laptop' or 'FreeBSD is bad because it doesn't boot on my laptop but Linux and Windows boot fine'. :-( (At least on my laptop) I found the malloc() was called from our code, i.e., AcpiOsExecute() from OsdSched.c. I'll try something shortly cause I was going to rewrite the file anyway. Thanks, Jung-uk Kim