Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/acpi We can no longer explicitly clear a GPE by call...



details:   https://anonhg.NetBSD.org/src/rev/6eeb36968268
branches:  trunk
changeset: 755457:6eeb36968268
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Sun Jun 06 18:56:10 2010 +0000

description:
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.

diffstat:

 sys/dev/acpi/acpi_ec.c |  12 ++----------
 1 files changed, 2 insertions(+), 10 deletions(-)

diffs (68 lines):

diff -r 0f96340bc023 -r 6eeb36968268 sys/dev/acpi/acpi_ec.c
--- a/sys/dev/acpi/acpi_ec.c    Sun Jun 06 18:40:51 2010 +0000
+++ b/sys/dev/acpi/acpi_ec.c    Sun Jun 06 18:56:10 2010 +0000
@@ -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 <joerg%NetBSD.org@localhost>.
@@ -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);



Home | Main Index | Thread Index | Old Index