> panic: kernel diagnostic assertion "__mp_lock_held(&sched_lock) == 0" failed: 
> file "../../../../kern/kern_lock.c", line 362

Ok, this panic happened because...

> Stopped at      Debugger+0x5:   leave
> RUN AT LEAST 'trace' AND 'ps' AND INCLUDE OUTPUT WHEN REPORTING THIS PANIC!
> IF RUNNING SMP, USE 'mach ddbcpu <#>' AND 'trace' ON OTHER PROCESSORS, TOO.
> DO NOT EVEN BOTHER REPORTING THIS WITHOUT INCLUDING THAT INFORMATION!
> ddb{1}> trace
> Debugger() at Debugger+0x5
> panic() at panic+0xe4
> __assert() at __assert +0x21
> _kernel_lock_init() at _kernel_lock_init
> trap() at trap+0x439
> --- trap (number 6) ---

...we unexpectedly go a page fault in the middle of a context switch,
because we probably had a stack overflow:

> cpu_switchto() at cpu_switchto+0x6b
> sleep_finish() at sleep_finish+0x9b
> tsleep() at tsleep+0x95
> aml_xparse() at aml_xparse+0x17dc
> aml_xeval() at aml_xeval+0x1c8
> aml_xparse() at aml_xparse+0x1413
> aml_xparse() at aml_xparse+0x1dc
> aml_xeval() at aml_xeval+0x1c8
> aml_xparse() at aml_xparse+0x1413
> aml_xeval() at aml_xeval+0x1c8
> aml_evalnode() at aml_evalnode+0x63
> acpibat_getbst() at acpibat_getbst+0x61
> acpibat_refresh() at acpibat_refresh+0x71
> acpibat_notify() at acpibat_notify+0x5f
> aml_notify() at aml_notify+0x4a
> aml_xparse() at aml_xparse+0xffa
> aml_xeval() at aml_xeval+0x1c8
> aml_xparse() at aml_xparse+0x1413
> aml_xeval() at aml_xeval+0x1c8
> aml_xparse() at aml_xparse+0x1413
> aml_xeval() at aml_xeval+0x1c8
> aml_evalnode() at aml_evalnode+0x63
> acpibat_getbif() at acpibat_getbif+0x55
> acpibat_refresh() at acpibat_refresh+0x69
> acpibat_notify() at acpibat_notify+0x5f
> aml_notify() at aml_notify+0x4a
> aml_xparse() at aml_xparse+0xffa
> aml_xeval() at aml_xeval+0x1c8
> aml_xparse() at aml_xparse+0x1413
> aml_xeval() at aml_xeval+0x1c8
> aml_evalnode() at aml_evalnode+0x63
> acpibat_getbst() at acpibat_getbst+0x61
> acpibat_refresh() at acpibat_refresh+0x71
> acpibat_notify() at acpibat_notify+0x5f
> aml_notify() at aml_notify+0x4a
> aml_xparse() at aml_xparse+0xffa
> aml_xeval() at aml_xeval+0x1c8
> aml_xparse() at aml_xparse+0x1413
> aml_xeval() at aml_xeval+0x1c8
> aml_xparse() at aml_xparse+0x1413
> aml_xeval() at aml_xeval+0x1c8
> aml_evalnode() at aml_evalnode+0x63
> acpibat_getbif() at acpibat_getbif+0x55
> acpibat_refresh() at acpibat_refresh+0x69
> acpibat_notify() at acpibat_notify+0x5f
> aml_notify() at aml_notify+0x4a
> aml_xparse() at aml_xparse+0xffa
> aml_xeval() at aml_xeval+0x1c8
> aml_xparse() at aml_xparse+0x1413
> aml_xeval() at aml_xeval+0x1c8
> aml_evalnode() at aml_evalnode+0x63
> acpibat_getbst() at acpibat_getbst+0x61
> acpibat_refresh() at acpibat_refresh+0x71
> acpibat_notify() at acpibat_notify+0x5f
> aml_notify() at aml_notify+0x4a
> aml_xparse() at aml_xparse+0xffa
> aml_xeval() at aml_xeval+0x1c8
> aml_xparse() at aml_xparse+0x1413
> aml_xeval() at aml_xeval+0x1c8
> aml_xparse() at aml_xparse+0x1413
> aml_xeval() at aml_xeval+0x1c8
> aml_evalnode() at aml_evalnode+0x63
> acpibat_getbif() at acpibat_getbif+0x55
> acpibat_refresh() at acpibat_refresh+0x69
> acpibat_notify() at acpibat_notify+0x5f
> aml_notify() at aml_notify+0x4a
> aml_xparse() at aml_xparse+0xffa
> aml_xeval() at aml_xeval+0x1c8
> aml_xparse() at aml_xparse+0x1413
> aml_xeval() at aml_xeval+0x1c8
> aml_evalnode() at aml_evalnode+0x63
> acpibat_getbst() at acpibat_getbst+0x61
> acpibat_refresh() at acpibat_refresh+0x71
> acpibat_notify() at acpibat_notify+0x5f
> aml_notify() at aml_notify+0x4a
> aml_xparse() at aml_xparse+0xffa
> aml_xeval() at aml_xeval+0x1c8
> aml_xparse() at aml_xparse+0x1413
> aml_xeval() at aml_xeval+0x1c8
> aml_xparse() at aml_xparse+0x1413
> aml_xeval() at aml_xeval+0x1c8
> aml_evalnode() at aml_evalnode+0x63
> acpibat_getbif() at acpibat_getbif+0x55
> acpibat_refresh() at acpibat_refresh+0x69
> acpibat_notify() at acpibat_notify+0x5f
> aml_notify() at aml_notify+0x4a
> aml_xparse() at aml_xparse+0xffa
> aml_xeval() at aml_xeval+0x1c8
> aml_xparse() at aml_xparse+0x1413
> aml_xeval() at aml_xeval+0x1c8
> aml_evalnode() at aml_evalnode+0x63
> acpibat_getbst() at acpibat_getbst+0x61
> acpibat_refresh() at acpibat_refresh+0x71
> acpibat_notify() at acpibat_notify+0x5f
> aml_notify() at aml_notify+0x4a
> aml_xparse() at aml_xparse+0xffa
> aml_xeval() at aml_xeval+0x1c8
> aml_xparse() at aml_xparse+0x1413
> aml_xeval() at aml_xeval+0x1c8
> aml_xparse() at aml_xparse+0x1413
> aml_xeval() at aml_xeval+0x1c8
> aml_evalnode() at aml_evalnode+0x63
> acpibat_getbif() at acpibat_getbif+0x55
> acpibat_refresh() at acpibat_refresh+0x69
> acpibat_notify() at acpibat_notify+0x5f
> aml_notify() at aml_notify+0x4a
> aml_xparse() at aml_xparse+0xffa
> aml_xeval() at aml_xeval+0x1c8
> aml_xparse() at aml_xparse+0x1413
> aml_xeval() at aml_xeval+0x1c8
> aml_evalnode() at aml_evalnode+0x63
> acpibat_getbst() at acpibat_getbst+0x61
> acpibat_refresh() at acpibat_refresh+0x71
> acpibat_notify() at acpibat_notify+0x5f
> aml_notify() at aml_notify+0x4a
> aml_xparse() at aml_xparse+0xffa
> aml_xeval() at aml_xeval+0x1c8
> aml_xparse() at aml_xparse+0x1413
> aml_xeval() at aml_xeval+0x1c8
> aml_xparse() at aml_xparse+0x1413
> aml_xeval() at aml_xeval+0x1c8
> aml_evalnode() at aml_evalnode+0x63
> acpibat_getbif() at acpibat_getbif+0x55
> acpibat_refresh() at acpibat_refresh+0x69
> acpibat_notify() at acpibat_notify+0x5f
> aml_notify() at aml_notify+0x4a
> aml_xparse() at aml_xparse+0xffa
> aml_xeval() at aml_xeval+0x1c8
> aml_xparse() at aml_xparse+0x1413
> aml_xeval() at aml_xeval+0x1c8
> aml_evalnode() at aml_evalnode+0x63
> acpibat_getbst() at acpibat_getbst+0x61
> acpibat_refresh() at acpibat_refresh+0x71
> acpibat_notify() at acpibat_notify+0x5f
> aml_notify() at aml_notify+0x4a
> aml_xparse() at aml_xparse+0xffa
> aml_xeval() at aml_xeval+0x1c8
> aml_xparse() at aml_xparse+0x1413
> aml_xeval() at aml_xeval+0x1c8
> aml_xparse() at aml_xparse+0x1413
> aml_xeval() at aml_xeval+0x1c8
> aml_evalnode() at aml_evalnode+0x63
> acpibat_getbif() at acpibat_getbif+0x55
> acpibat_refresh() at acpibat_refresh+0x69
> acpibat_notify() at acpibat_notify+0x5f
> aml_notify() at aml_notify+0x4a
> aml_xparse() at aml_xparse+0xffa
> aml_xeval() at aml_xeval+0x1c8
> aml_xparse() at aml_xparse+0x1413
> aml_xeval() at aml_xeval+0x1c8
> aml_evalnode() at aml_evalnode+0x63
> acpibat_getbst() at acpibat_getbst+0x61
> acpibat_refresh() at acpibat_refresh+0x71
> acpibat_notify() at acpibat_notify+0x5f
> aml_notify() at aml_notify+0x4a
> aml_xparse() at aml_xparse+0xffa
> aml_xeval() at aml_xeval+0x1c8
> aml_xparse() at aml_xparse+0x1413
> aml_xeval() at aml_xeval+0x1c8
> aml_xparse() at aml_xparse+0x1413
> aml_xeval() at aml_xeval+0x1c8
> aml_evalnode() at aml_evalnode+0x63
> acpibat_getbif() at acpibat_getbif+0x55
> acpibat_refresh() at acpibat_refresh+0x69
> acpibat_notify() at acpibat_notify+0x5f
> aml_notify() at aml_notify+0x4a
> aml_xparse() at aml_xparse+0xffa
> aml_xeval() at aml_xeval+0x1c8
> aml_xparse() at aml_xparse+0x1413
> aml_xeval() at aml_xeval+0x1c8
> aml_evalnode() at aml_evalnode+0x63
> acpibat_getbst() at acpibat_getbst+0x61
> acpibat_refresh() at acpibat_refresh+0x71
> acpibat_notify() at acpibat_notify+0x5f
> acpi_poll_notify() at acpi_poll_notify+0x3b
> acpi_thread() at acpi_thread+0x273
> end trace frame: 0x0, count: -181

Can you try the following diff?

Cheers,

Mark


Index: acpibat.c
===================================================================
RCS file: /cvs/src/sys/dev/acpi/acpibat.c,v
retrieving revision 1.57
diff -u -p -r1.57 acpibat.c
--- acpibat.c   7 Aug 2010 16:55:38 -0000       1.57
+++ acpibat.c   7 Nov 2010 21:04:36 -0000
@@ -186,13 +186,6 @@ acpibat_refresh(void *arg)
                return;
        }
 
-       /*
-        * XXX don't really need _BIF but keep it here in case we
-        * miss an insertion/removal event
-        */
-       acpibat_getbif(sc);
-       acpibat_getbst(sc);
-
        /* _BIF values are static, sensor 0..3 */
        if (sc->sc_bif.bif_last_capacity == BIF_UNKNOWN) {
                sc->sc_sens[0].value = 0;
@@ -386,7 +379,8 @@ out:
        return (rv);
 }
 
-/* XXX it has been observed that some systems do not propagate battery
+/*
+ * XXX it has been observed that some systems do not propagate battery
  * insertion events up to the driver.  What seems to happen is that DSDT
  * does receive an interrupt however the originator bit is not set.
  * This seems to happen when one inserts a 100% full battery.  Removal
@@ -400,23 +394,25 @@ acpibat_notify(struct aml_node *node, in
 {
        struct acpibat_softc    *sc = arg;
        int64_t                 sta;
-       int                     present;
 
        dnprintf(10, "acpibat_notify: %.2x %s\n", notify_type,
            sc->sc_devnode->name);
 
        /* Check if installed state of battery has changed */
        if (aml_evalinteger(sc->sc_acpi, node, "_STA", 0, NULL, &sta) == 0) {
-               present = sta & STA_BATTERY;
-               if (!sc->sc_bat_present && present)
+               if (sta & STA_BATTERY)
                        sc->sc_bat_present = 1;
-               else if (sc->sc_bat_present && !present)
+               else
                        sc->sc_bat_present = 0;
        }
+
        switch (notify_type) {
+       case 0x00:      /* Poll sensors */
        case 0x80:      /* _BST changed */
+               acpibat_getbst(sc);
                break;
        case 0x81:      /* _BIF changed */
+               acpibat_getbif(sc);
                break;
        default:
                break;

Reply via email to