On Sat, Apr 25, 2015 at 08:59:45AM +0800, Paul Goyette wrote: > For some reason, the sme_global_mtx seems to already be locked when > sysmon_envsys_register tries to get it.
No, it is not initialized: aibs0 at acpi0 (ASOC, ATK0110-16843024): ASUSTeK AI Booster panic: lockdebug_lookup: uninitialized lock (lock=0xffffffff811aa9a0, from=ffffffff808f320f) fatal breakpoint trap in supervisor mode trap type 1 code 0 rip ffffffff8028b8bd cs 8 rflags 246 cr2 0 ilevel 8 rsp ffffffff8135ea60 curlwp 0xffffffff810e4940 pid 0.1 lowest kstack 0xffffffff8135b2c0 Stopped in pid 0.1 (system) at netbsd:breakpoint+0x5: leave db{0}> bt breakpoint() at netbsd:breakpoint+0x5 vpanic() at netbsd:vpanic+0x13c snprintf() at netbsd:snprintf lockdebug_locked() at netbsd:lockdebug_locked mutex_enter() at netbsd:mutex_enter+0x43f sysmon_envsys_register() at netbsd:sysmon_envsys_register+0x41 aibs_attach() at netbsd:aibs_attach+0x19a config_attach_loc() at netbsd:config_attach_loc+0x17a acpi_rescan() at netbsd:acpi_rescan+0x20d acpi_attach() at netbsd:acpi_attach+0x2f1 config_attach_loc() at netbsd:config_attach_loc+0x17a mainbus_attach() at netbsd:mainbus_attach+0x2a6 config_attach_loc() at netbsd:config_attach_loc+0x17a cpu_configure() at netbsd:cpu_configure+0x26 main() at netbsd:main+0x29e Additionally there seems to be a missing mutex_exit() in an error branch: Index: sysmon_envsys.c =================================================================== RCS file: /cvsroot/src/sys/dev/sysmon/sysmon_envsys.c,v retrieving revision 1.132 diff -u -p -r1.132 sysmon_envsys.c --- sysmon_envsys.c 24 Apr 2015 03:32:25 -0000 1.132 +++ sysmon_envsys.c 25 Apr 2015 05:28:20 -0000 @@ -779,6 +779,7 @@ sysmon_envsys_register(struct sysmon_env mutex_enter(&sme_global_mtx); if (!prop_dictionary_set(sme_propd, sme->sme_name, array)) { error = EINVAL; + mutex_exit(&sme_global_mtx); DPRINTF(("%s: prop_dictionary_set for '%s'\n", __func__, sme->sme_name)); goto out; Martin