From owner-freebsd-acpi@FreeBSD.ORG Fri Sep 21 23:16:18 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 0492916A418; Fri, 21 Sep 2007 23:16:18 +0000 (UTC) (envelope-from robert.moore@intel.com) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx1.freebsd.org (Postfix) with ESMTP id BC8D413C44B; Fri, 21 Sep 2007 23:16:17 +0000 (UTC) (envelope-from robert.moore@intel.com) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP; 21 Sep 2007 15:47:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.20,285,1186383600"; d="scan'208";a="147546736" Received: from orsmsx334.jf.intel.com ([10.22.226.45]) by fmsmga002.fm.intel.com with ESMTP; 21 Sep 2007 15:47:29 -0700 Received: from orsmsx415.amr.corp.intel.com ([10.22.226.49]) by orsmsx334.jf.intel.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 21 Sep 2007 15:47:28 -0700 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Date: Fri, 21 Sep 2007 15:47:21 -0700 Message-ID: In-Reply-To: <200709211827.29763.jkim@FreeBSD.org> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PATCH] OsdSynch.c modernization thread-index: Acf8nqwbRg8q4w5ORsikv2fnT1cQ0wAAonQQ References: <200709181516.11207.jkim@FreeBSD.org><200709211715.17940.jhb@freebsd.org> <200709211827.29763.jkim@FreeBSD.org> From: "Moore, Robert" To: "Jung-uk Kim" , "John Baldwin" X-OriginalArrivalTime: 21 Sep 2007 22:47:28.0406 (UTC) FILETIME=[62FD7360:01C7FCA1] Cc: freebsd-acpi@FreeBSD.org, freebsd-current@FreeBSD.org 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: Fri, 21 Sep 2007 23:16:18 -0000 I can look around a bit, but I don't think we'd make any system calls while holding a spinlock.=20 Bob >-----Original Message----- >From: owner-freebsd-acpi@freebsd.org [mailto:owner-freebsd- >acpi@freebsd.org] On Behalf Of Jung-uk Kim >Sent: Friday, September 21, 2007 3:27 PM >To: John Baldwin >Cc: freebsd-acpi@FreeBSD.org; freebsd-current@FreeBSD.org >Subject: Re: [PATCH] OsdSynch.c modernization > >On Friday 21 September 2007 05:15 pm, John Baldwin wrote: >> On Tuesday 18 September 2007 03:16:07 pm Jung-uk Kim wrote: >> > I have rewritten sys/dev/acpica/Osd/OsdSynch.c to match the >> > modern ACPI-CA and -CURRENT: >> > >> > http://people.freebsd.org/~jkim/acpica/OsdSynch.diff >> >> Why do you use a loop around tsleep() rather than just use >> sx_xlock() (which will block) for the WAIT_FOREVER case when >> waiting on a semaphore? > >You mean for AcpiOsAcquireMutex()? sx_xlock() cannot be waken up by >the wait channel. > >> Why don't you just use a spin mutex for the spin lock? >> That is a far better fit than the sx lock stuff you are doing. >> Manually doing spinlock_enter() (wrongly btw, you should use >> critical_enter(), not sched_pin() otherwise you can be preempted) >> just to avoid the assertion failure is just going to result in >> obscure hangs. Does ACPI-CA want to malloc() while holding an ACPI >> spin lock or something? > >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 =3D 0 >KDB: enter: panic >[thread pid 21 tid 100013 ] >Stopped at kdb_enter+0x32: leave > >http://docs.freebsd.org/cgi/mid.cgi?200709121927.46465.jkim > >I guess it wants to malloc() while holding spin lock although I >haven't traced it down. > >I intend to investigate and fix further after RELENG_7 is branched and >I really like to hear more ideas from you. > >Thanks, > >Jung-uk Kim >_______________________________________________ >freebsd-acpi@freebsd.org mailing list >http://lists.freebsd.org/mailman/listinfo/freebsd-acpi >To unsubscribe, send any mail to "freebsd-acpi-unsubscribe@freebsd.org"