Current-Users archive

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

Re: kernel fault -current of 23/24 Apr 2015



I do not like the init_main change - the attached patch makes my system boot
with a LOCKDEBUG kernel.

Not sure if this is complete.

Martin
Index: sysmon_envsys.c
===================================================================
RCS file: /cvsroot/src/sys/dev/sysmon/sysmon_envsys.c,v
retrieving revision 1.135
diff -u -p -r1.135 sysmon_envsys.c
--- sysmon_envsys.c	25 Apr 2015 02:41:42 -0000	1.135
+++ sysmon_envsys.c	25 Apr 2015 11:34:57 -0000
@@ -101,6 +101,7 @@ static sme_event_drv_t * sme_add_sensor_
 static void sme_initial_refresh(void *);
 static uint32_t sme_get_max_value(struct sysmon_envsys *,
      bool (*)(const envsys_data_t*), bool);
+static void sme_preinit(void);
 
 MODULE(MODULE_CLASS_MISC, sysmon_envsys, "sysmon,sysmon_taskq,sysmon_power");
 
@@ -109,6 +110,20 @@ static struct sysmon_opvec sysmon_envsys
         NULL, NULL, NULL
 };
 
+static void
+sme_preinit(void)
+{
+	static bool passed = false;
+
+	if (passed)
+		return;
+
+	passed = true;
+	LIST_INIT(&sysmon_envsys_list);
+	mutex_init(&sme_global_mtx, MUTEX_DEFAULT, IPL_NONE);
+	sme_propd = prop_dictionary_create();
+}
+
 /*
  * sysmon_envsys_init:
  *
@@ -119,9 +134,7 @@ sysmon_envsys_init(void)
 {
 	int error;
 
-	LIST_INIT(&sysmon_envsys_list);
-	mutex_init(&sme_global_mtx, MUTEX_DEFAULT, IPL_NONE);
-	sme_propd = prop_dictionary_create();
+	sme_preinit();
 
 	error = sysmon_attach_minor(SYSMON_MINOR_ENVSYS, &sysmon_envsys_opvec);
 
@@ -680,6 +693,8 @@ sysmon_envsys_register(struct sysmon_env
 	KASSERT(sme != NULL);
 	KASSERT(sme->sme_name != NULL);
 
+	sme_preinit();
+
 	/*
 	 * Check if requested sysmon_envsys device is valid
 	 * and does not exist already in the list.


Home | Main Index | Thread Index | Old Index