Module Name:    src
Committed By:   jruoho
Date:           Sun Jun  6 18:56:10 UTC 2010

Modified Files:
        src/sys/dev/acpi: acpi_ec.c

Log Message:
We can no longer explicitly clear a GPE by calling AcpiClearGpe() in the
interrupt handler. However, all edge-triggered GPEs should already be
cleared before our GPE handler has a chance to run.

The reason can be found from the changes in the locking primitives of
ACPICA. All GPE operations now use a spin mutex on AcpiGbl_GpeLock, acquired
via AcpiOsAcquireLock(). This same lock is now acquired unconditionally in
the AcpiClearGpe() function. This causes a deadlock of the following form:

  ...

  AcpiEvGpeDetect() : acquire AcpiGbl_GpeLock;

          -> AcpiEvGpeDispatch();

                  -> acpiec_gpe_handler();

                          -> AcpiClearGpe() : acquire AcpiGbl_GpeLock;

                                  -> panic.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/dev/acpi/acpi_ec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpi_ec.c
diff -u src/sys/dev/acpi/acpi_ec.c:1.66 src/sys/dev/acpi/acpi_ec.c:1.67
--- src/sys/dev/acpi/acpi_ec.c:1.66	Sun Jun  6 18:40:51 2010
+++ src/sys/dev/acpi/acpi_ec.c	Sun Jun  6 18:56:10 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_ec.c,v 1.66 2010/06/06 18:40:51 jruoho Exp $	*/
+/*	$NetBSD: acpi_ec.c,v 1.67 2010/06/06 18:56:10 jruoho Exp $	*/
 
 /*-
  * Copyright (c) 2007 Joerg Sonnenberger <[email protected]>.
@@ -59,7 +59,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.66 2010/06/06 18:40:51 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.67 2010/06/06 18:56:10 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/callout.h>
@@ -575,7 +575,6 @@
 		}
 		if (sc->sc_state != EC_STATE_FREE) {
 			mutex_exit(&sc->sc_mtx);
-			AcpiClearGpe(sc->sc_gpeh, sc->sc_gpebit);
 			acpiec_unlock(dv);
 			aprint_error_dev(dv, "command timed out, state %d\n",
 			    sc->sc_state);
@@ -583,7 +582,6 @@
 		}
 	} else if (cv_timedwait(&sc->sc_cv, &sc->sc_mtx, EC_CMD_TIMEOUT * hz)) {
 		mutex_exit(&sc->sc_mtx);
-		AcpiClearGpe(sc->sc_gpeh, sc->sc_gpebit);
 		acpiec_unlock(dv);
 		aprint_error_dev(dv, "command takes over %d sec...\n", EC_CMD_TIMEOUT);
 		return AE_ERROR;
@@ -624,7 +622,6 @@
 		}
 		if (sc->sc_state != EC_STATE_FREE) {
 			mutex_exit(&sc->sc_mtx);
-			AcpiClearGpe(sc->sc_gpeh, sc->sc_gpebit);
 			acpiec_unlock(dv);
 			aprint_error_dev(dv, "command timed out, state %d\n",
 			    sc->sc_state);
@@ -632,7 +629,6 @@
 		}
 	} else if (cv_timedwait(&sc->sc_cv, &sc->sc_mtx, EC_CMD_TIMEOUT * hz)) {
 		mutex_exit(&sc->sc_mtx);
-		AcpiClearGpe(sc->sc_gpeh, sc->sc_gpebit);
 		acpiec_unlock(dv);
 		aprint_error_dev(dv, "command takes over %d sec...\n", EC_CMD_TIMEOUT);
 		return AE_ERROR;
@@ -842,8 +838,6 @@
 	device_t dv = arg;
 	struct acpiec_softc *sc = device_private(dv);
 
-	AcpiClearGpe(sc->sc_gpeh, sc->sc_gpebit);
-
 	mutex_enter(&sc->sc_mtx);
 	acpiec_gpe_state_machine(dv);
 	mutex_exit(&sc->sc_mtx);
@@ -855,8 +849,6 @@
 	device_t dv = arg;
 	struct acpiec_softc *sc = device_private(dv);
 
-	AcpiClearGpe(sc->sc_gpeh, sc->sc_gpebit);
-
 	mutex_enter(&sc->sc_mtx);
 	acpiec_gpe_state_machine(dv);
 	mutex_exit(&sc->sc_mtx);

Reply via email to