From owner-freebsd-bugs@FreeBSD.ORG Tue Jul 17 01:40:04 2007 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F138E16A401 for ; Tue, 17 Jul 2007 01:40:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freebsd.org [69.147.83.40]) by mx1.freebsd.org (Postfix) with ESMTP id D286F13C442 for ; Tue, 17 Jul 2007 01:40:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.1/8.14.1) with ESMTP id l6H1e3qd012499 for ; Tue, 17 Jul 2007 01:40:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.1/8.14.1/Submit) id l6H1e3u3012498; Tue, 17 Jul 2007 01:40:03 GMT (envelope-from gnats) Resent-Date: Tue, 17 Jul 2007 01:40:03 GMT Resent-Message-Id: <200707170140.l6H1e3u3012498@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Cristian KLEIN Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4CB2716A405 for ; Tue, 17 Jul 2007 01:33:48 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (groups.freebsd.org [69.147.83.33]) by mx1.freebsd.org (Postfix) with ESMTP id 3A28613C49D for ; Tue, 17 Jul 2007 01:33:48 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.1/8.14.1) with ESMTP id l6H1XmUi015643 for ; Tue, 17 Jul 2007 01:33:48 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.1/8.14.1/Submit) id l6H1Xlv8015631; Tue, 17 Jul 2007 01:33:47 GMT (envelope-from nobody) Message-Id: <200707170133.l6H1Xlv8015631@www.freebsd.org> Date: Tue, 17 Jul 2007 01:33:47 GMT From: Cristian KLEIN To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.0 Cc: Subject: kern/114649: [patch][acpi] panic: recursed on non-recursive mutex X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jul 2007 01:40:04 -0000 >Number: 114649 >Category: kern >Synopsis: [patch][acpi] panic: recursed on non-recursive mutex >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Jul 17 01:40:03 GMT 2007 >Closed-Date: >Last-Modified: >Originator: Cristian KLEIN >Release: 7.0-CURRENT >Organization: Technical University of Cluj-Napoca >Environment: FreeBSD hades.local 7.0-CURRENT FreeBSD 7.0-CURRENT #11: Tue Jul 17 04:08:17 EEST 2007 cristi@hades.local:/usr/obj/usr/src/sys/GENERIC i386 (source updated immediately before compiling) >Description: When resuming (from S3) an IBM Thinkpad R51 laptop, KDB is entered with the following panic string (written by hand): panic: _mtx_lock_sleep: recursed on non-recursive mutex acpi subsystem GPE lock @ ......./OsdSynch.c:377 >How-To-Repeat: Suspend (S3) / resume a laptop. Panic will always occur after the first resume. >Fix: It seems to me that ACPI vendor code was not designed to use non-recursive mutexes. For example: * AcpiEvGpeDetect() calls AcpiOsAcquireLock(AcpiGbl_GpeLock) in contrib/dev/acpica/evgpe.c:511, then calls AcpiEvGpeDispatch() * AcpiEvGpeDispatch() calls AcpiHwDisableAllGpes() in evgpe.c:762 * AcpiHwDisableAllGpes() calls AcpiEvWalkGpeList in hwgpe.c:487 * AcpiEvWalkGpeList() calls AcpiOsAcquireLock(AcpiGbl_GpeLock) *again* in evgpeblk.c:237 Rather that correcting contributed code (in who knows how many places) and then have problems in the future (when the ACPI vendor code is upgraded), I suggest making the ACPI GPE lock recursable. The patch below does this. After applying this patch, I've been able to suspend / resume 20+ times. Patch attached with submission follows: --- sys/dev/acpica/Osd/OsdSynch.c.orig 2007-03-27 02:04:02.000000000 +0300 +++ sys/dev/acpica/Osd/OsdSynch.c 2007-07-17 04:17:37.073597342 +0300 @@ -346,7 +346,7 @@ snprintf(h->name, sizeof(h->name), "acpi subsystem HW lock"); else snprintf(h->name, sizeof(h->name), "acpi subsys %p", OutHandle); - mtx_init(&h->lock, h->name, NULL, MTX_DEF); + mtx_init(&h->lock, h->name, NULL, MTX_DEF | MTX_RECURSE); *OutHandle = (ACPI_SPINLOCK)h; return (AE_OK); } >Release-Note: >Audit-Trail: >Unformatted: