Bug 114649

Summary: [patch][acpi] panic: recursed on non-recursive mutex
Product: Base System Reporter: Cristian KLEIN <cristi>
Component: kernAssignee: freebsd-acpi (Nobody) <acpi>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 7.0-CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Cristian KLEIN 2007-07-17 02:40:03 UTC
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

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:
How-To-Repeat: Suspend (S3) / resume a laptop. Panic will always occur after the first resume.
Comment 1 K. Macy freebsd_committer freebsd_triage 2007-11-16 18:18:34 UTC
Responsible Changed
From-To: freebsd-bugs->acpi


Assign to owner
Comment 2 Remko Lodder freebsd_committer freebsd_triage 2007-11-16 18:21:26 UTC
Responsible Changed
From-To: acpi->freebsd-acpi

Towards expanded group
Comment 3 Ed Maste freebsd_committer freebsd_triage 2008-04-03 20:44:53 UTC
I have this same problem on my thinkpad T20.

kern/114113 is the same issue.
Comment 4 Takanori Watanabe freebsd_committer freebsd_triage 2008-04-06 03:37:46 UTC
State Changed
From-To: open->closed

I encountered same problem on ThinkPad X61 uni processor suspend/resume. And  
fixed on the same way.