Home | History | Annotate | Line # | Download | only in sysmon
sysmon_envsys_events.c revision 1.10
      1 /* $NetBSD: sysmon_envsys_events.c,v 1.10 2007/07/13 22:49:15 xtraeme Exp $ */
      2 
      3 /*-
      4  * Copyright (c) 2007 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by Juan Romero Pardines.
      9  *
     10  * Redistribution and use in source and binary forms, with or without
     11  * modification, are permitted provided that the following conditions
     12  * are met:
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice, this list of conditions and the following disclaimer.
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in the
     17  *    documentation and/or other materials provided with the distribution.
     18  * 3. All advertising materials mentioning features or use of this software
     19  *    must display the following acknowledgement:
     20  *      This product includes software developed by Juan Romero Pardines
     21  *      for the NetBSD Foundation, Inc. and its contributors.
     22  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  *    contributors may be used to endorse or promote products derived
     24  *    from this software without specific prior written permission.
     25  *
     26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  * POSSIBILITY OF SUCH DAMAGE.
     37  */
     38 
     39 /*
     40  * sysmon_envsys(9) events framework.
     41  */
     42 
     43 #include <sys/cdefs.h>
     44 __KERNEL_RCSID(0, "$NetBSD: sysmon_envsys_events.c,v 1.10 2007/07/13 22:49:15 xtraeme Exp $");
     45 
     46 #include <sys/param.h>
     47 #include <sys/types.h>
     48 #include <sys/conf.h>
     49 #include <sys/errno.h>
     50 #include <sys/kernel.h>
     51 #include <sys/sysctl.h>
     52 #include <sys/systm.h>
     53 #include <sys/proc.h>
     54 #include <sys/mutex.h>
     55 #include <sys/kmem.h>
     56 #include <sys/callout.h>
     57 
     58 #include <dev/sysmon/sysmonvar.h>
     59 #include <dev/sysmon/sysmon_envsysvar.h>
     60 
     61 struct sme_sensor_state {
     62 	int		type;
     63 	const char 	*desc;
     64 };
     65 
     66 struct sme_sensor_event {
     67 	int		state;
     68 	int		event;
     69 };
     70 
     71 static const struct sme_sensor_state sme_sensor_drive_state[] = {
     72 	{ ENVSYS_DRIVE_EMPTY, 		"drive state is unknown" },
     73 	{ ENVSYS_DRIVE_READY, 		"drive is ready" },
     74 	{ ENVSYS_DRIVE_POWERUP,		"drive is powering up" },
     75 	{ ENVSYS_DRIVE_ONLINE, 		"drive is online" },
     76 	{ ENVSYS_DRIVE_IDLE, 		"drive is idle" },
     77 	{ ENVSYS_DRIVE_ACTIVE, 		"drive is active" },
     78 	{ ENVSYS_DRIVE_REBUILD, 	"drive is rebuilding" },
     79 	{ ENVSYS_DRIVE_POWERDOWN,	"drive is powering down" },
     80 	{ ENVSYS_DRIVE_FAIL, 		"drive failed" },
     81 	{ ENVSYS_DRIVE_PFAIL,		"drive degraded" },
     82 	{ -1, 				"unknown" }
     83 };
     84 
     85 static const struct sme_sensor_event sme_sensor_event[] = {
     86 	{ ENVSYS_SVALID, 	PENVSYS_EVENT_NORMAL },
     87 	{ ENVSYS_SCRITICAL, 	PENVSYS_EVENT_CRITICAL },
     88 	{ ENVSYS_SCRITOVER, 	PENVSYS_EVENT_CRITOVER },
     89 	{ ENVSYS_SCRITUNDER, 	PENVSYS_EVENT_CRITUNDER },
     90 	{ ENVSYS_SWARNOVER, 	PENVSYS_EVENT_WARNOVER },
     91 	{ ENVSYS_SWARNUNDER,	PENVSYS_EVENT_WARNUNDER },
     92 	{ -1, 			-1 }
     93 };
     94 
     95 static struct workqueue *seewq;
     96 static struct callout seeco;
     97 static bool sme_events_initialized = false;
     98 kmutex_t sme_mtx, sme_event_mtx, sme_event_init_mtx;
     99 
    100 /* 10 seconds of timeout for the callout */
    101 static int sme_events_timeout = 10;
    102 static int sme_events_timeout_sysctl(SYSCTLFN_PROTO);
    103 #define SME_EVTIMO 	(sme_events_timeout * hz)
    104 
    105 /*
    106  * sysctl(9) stuff to handle the refresh value in the callout
    107  * function.
    108  */
    109 static int
    110 sme_events_timeout_sysctl(SYSCTLFN_ARGS)
    111 {
    112 	struct sysctlnode node;
    113 	int timo, error;
    114 
    115 	node = *rnode;
    116 	timo = sme_events_timeout;
    117 	node.sysctl_data = &timo;
    118 
    119 	error = sysctl_lookup(SYSCTLFN_CALL(&node));
    120 	if (error || newp == NULL)
    121 		return error;
    122 
    123 	/* min 1s */
    124 	if (timo < 1)
    125 		return EINVAL;
    126 
    127 	sme_events_timeout = timo;
    128 	return 0;
    129 }
    130 
    131 SYSCTL_SETUP(sysctl_kern_envsys_timeout_setup, "sysctl kern.envsys subtree")
    132 {
    133 	const struct sysctlnode *node, *envsys_node;
    134 
    135 	sysctl_createv(clog, 0, NULL, &node,
    136 			CTLFLAG_PERMANENT,
    137 			CTLTYPE_NODE, "kern", NULL,
    138 			NULL, 0, NULL, 0,
    139 			CTL_KERN, CTL_EOL);
    140 
    141 	sysctl_createv(clog, 0, &node, &envsys_node,
    142 			0,
    143 			CTLTYPE_NODE, "envsys", NULL,
    144 			NULL, 0, NULL, 0,
    145 			CTL_CREATE, CTL_EOL);
    146 
    147 	sysctl_createv(clog, 0, &envsys_node, &node,
    148 			CTLFLAG_READWRITE,
    149 			CTLTYPE_INT, "refresh_value",
    150 			SYSCTL_DESCR("wait time in seconds to refresh "
    151 			    "sensors being monitored"),
    152 			sme_events_timeout_sysctl, 0, &sme_events_timeout, 0,
    153 			CTL_CREATE, CTL_EOL);
    154 }
    155 
    156 
    157 /*
    158  * sme_event_register:
    159  *
    160  * 	+ Registers a sysmon envsys event.
    161  * 	+ Creates a new sysmon envsys event.
    162  */
    163 int
    164 sme_event_register(sme_event_t *see)
    165 {
    166 	sme_event_t *lsee;
    167 	struct penvsys_state *pes_old, *pes_new;
    168 	int error = 0;
    169 
    170 	KASSERT(see != NULL);
    171 
    172 	pes_new = &see->pes;
    173 
    174 	mutex_enter(&sme_event_mtx);
    175 	/*
    176 	 * Ensure that we don't add events for the same sensor
    177 	 * and with the same type.
    178 	 */
    179 	LIST_FOREACH(lsee, &sme_events_list, see_list) {
    180 		pes_old = &lsee->pes;
    181 		if (strcmp(pes_old->pes_sensname,
    182 		    pes_new->pes_sensname) == 0) {
    183 			if (lsee->type == see->type) {
    184 				DPRINTF(("%s: dev=%s sensor=%s type=%d "
    185 				    "(already exists)\n", __func__,
    186 				    see->pes.pes_dvname,
    187 				    see->pes.pes_sensname, see->type));
    188 				error = EEXIST;
    189 				goto out;
    190 			}
    191 		}
    192 	}
    193 
    194 	DPRINTF(("%s: dev=%s sensor=%s snum=%d type=%d "
    195 	    "critval=%" PRIu32 "\n", __func__,
    196 	    see->pes.pes_dvname, see->pes.pes_sensname,
    197 	    see->snum, see->type, see->critval));
    198 
    199 	LIST_INSERT_HEAD(&sme_events_list, see, see_list);
    200 	/*
    201 	 * Initialize the events framework if it wasn't initialized
    202 	 * before.
    203 	 */
    204 	mutex_enter(&sme_event_init_mtx);
    205 	if (sme_events_initialized == false)
    206 		error = sme_events_init();
    207 	mutex_exit(&sme_event_init_mtx);
    208 
    209 out:
    210 	mutex_exit(&sme_event_mtx);
    211 	return error;
    212 }
    213 
    214 /*
    215  * sme_event_unregister:
    216  *
    217  * 	+ Unregisters a sysmon envsys event.
    218  */
    219 int
    220 sme_event_unregister(const char *sensor, int type)
    221 {
    222 	sme_event_t *see;
    223 	bool found = false;
    224 
    225 	KASSERT(sensor != NULL);
    226 
    227 	mutex_enter(&sme_event_mtx);
    228 	LIST_FOREACH(see, &sme_events_list, see_list) {
    229 		if (strcmp(see->pes.pes_sensname, sensor) == 0) {
    230 			if (see->type == type) {
    231 				found = true;
    232 				break;
    233 			}
    234 		}
    235 	}
    236 
    237 	if (!found) {
    238 		mutex_exit(&sme_event_mtx);
    239 		return EINVAL;
    240 	}
    241 
    242 	DPRINTF(("%s: removing dev=%s sensor=%s type=%d\n",
    243 	    __func__, see->pes.pes_dvname, sensor, type));
    244 	LIST_REMOVE(see, see_list);
    245 
    246 	/*
    247 	 * So the events list is empty, we'll do the following:
    248 	 *
    249 	 * 	- stop and destroy the callout.
    250 	 * 	- destroy the workqueue.
    251 	 */
    252 	if (LIST_EMPTY(&sme_events_list)) {
    253 		mutex_exit(&sme_event_mtx);
    254 
    255 		mutex_enter(&sme_event_init_mtx);
    256 		callout_stop(&seeco);
    257 		callout_destroy(&seeco);
    258 		workqueue_destroy(seewq);
    259 		sme_events_initialized = false;
    260 		DPRINTF(("%s: events framework destroyed\n", __func__));
    261 		mutex_exit(&sme_event_init_mtx);
    262 		goto out;
    263 	}
    264 
    265 	mutex_exit(&sme_event_mtx);
    266 	kmem_free(see, sizeof(*see));
    267 
    268 out:
    269 	return 0;
    270 }
    271 
    272 /*
    273  * sme_event_drvadd:
    274  *
    275  * 	+ Adds a new sysmon envsys event for a driver if a sensor
    276  * 	  has set any accepted monitoring flag.
    277  */
    278 void
    279 sme_event_drvadd(void *arg)
    280 {
    281 	sme_event_drv_t *sed_t = arg;
    282 	int error = 0;
    283 
    284 	KASSERT(sed_t != NULL);
    285 
    286 #define SEE_REGEVENT(a, b, c)						\
    287 do {									\
    288 	if (sed_t->edata->flags & (a)) {				\
    289 		char str[32] = "monitoring-state-";			\
    290 									\
    291 		error = sme_event_add(sed_t->sdict,			\
    292 				      sed_t->edata,			\
    293 				      sed_t->sme->sme_name,		\
    294 				      NULL,				\
    295 				      0,				\
    296 				      (b),				\
    297 				      sed_t->powertype);		\
    298 		if (error && error != EEXIST)				\
    299 			printf("%s: failed to add event! "		\
    300 			    "error=%d sensor=%s event=%s\n",		\
    301 			    __func__, error, sed_t->edata->desc, (c));	\
    302 		else {							\
    303 			mutex_enter(&sme_mtx);				\
    304 			(void)strlcat(str, (c), sizeof(str));		\
    305 			prop_dictionary_set_bool(sed_t->sdict,		\
    306 						 str,			\
    307 						 true);			\
    308 			mutex_exit(&sme_mtx);				\
    309 		}							\
    310 	}								\
    311 } while (/* CONSTCOND */ 0)
    312 
    313 	SEE_REGEVENT(ENVSYS_FMONCRITICAL,
    314 		     PENVSYS_EVENT_CRITICAL,
    315 		     "critical");
    316 
    317 	SEE_REGEVENT(ENVSYS_FMONCRITUNDER,
    318 		     PENVSYS_EVENT_CRITUNDER,
    319 		     "critunder");
    320 
    321 	SEE_REGEVENT(ENVSYS_FMONCRITOVER,
    322 		     PENVSYS_EVENT_CRITOVER,
    323 		     "critover");
    324 
    325 	SEE_REGEVENT(ENVSYS_FMONWARNUNDER,
    326 		     PENVSYS_EVENT_WARNUNDER,
    327 		     "warnunder");
    328 
    329 	SEE_REGEVENT(ENVSYS_FMONWARNOVER,
    330 		     PENVSYS_EVENT_WARNOVER,
    331 		     "warnover");
    332 
    333 	SEE_REGEVENT(ENVSYS_FMONDRVSTATE,
    334 		     PENVSYS_EVENT_DRIVE_STCHANGED,
    335 		     "drvstchanged");
    336 
    337 	/* we are done, free memory now */
    338 	kmem_free(sed_t, sizeof(*sed_t));
    339 }
    340 
    341 /*
    342  * sme_event_add:
    343  *
    344  * 	+ Initializes or updates a sysmon envsys event.
    345  */
    346 int
    347 sme_event_add(prop_dictionary_t sdict, envsys_data_t *edata,
    348 	      const char *drvn, const char *objkey,
    349 	      int32_t critval, int crittype, int powertype)
    350 {
    351 	sme_event_t *see = NULL;
    352 	prop_object_t obj;
    353 	int error = 0;
    354 
    355 	KASSERT(sdict != NULL || edata != NULL);
    356 
    357 	/* critical condition set via userland */
    358 	if (objkey && critval) {
    359 		obj = prop_dictionary_get(sdict, objkey);
    360 		if (obj != NULL) {
    361 			/*
    362 			 * object is already in dictionary, update
    363 			 * the critical value.
    364 			 */
    365 			mutex_enter(&sme_event_mtx);
    366 	 		LIST_FOREACH(see, &sme_events_list, see_list) {
    367 				if (strcmp(edata->desc,
    368 				    see->pes.pes_sensname) == 0)
    369 					if (crittype == see->type)
    370 						break;
    371 		 	}
    372 			see->critval = critval;
    373 			mutex_exit(&sme_event_mtx);
    374 			DPRINTF(("%s: event updated\n", __func__));
    375 			goto out;
    376 		}
    377 	}
    378 
    379 	if (LIST_EMPTY(&sme_events_list))
    380 		goto register_event;
    381 
    382 	/* check if the event is already on the list */
    383 	mutex_enter(&sme_event_mtx);
    384 	LIST_FOREACH(see, &sme_events_list, see_list) {
    385 		if (strcmp(edata->desc, see->pes.pes_sensname) == 0)
    386 			if (crittype == see->type) {
    387 				mutex_exit(&sme_event_mtx);
    388 				error = EEXIST;
    389 				goto out;
    390 			}
    391 	}
    392 	mutex_exit(&sme_event_mtx);
    393 
    394 	/*
    395 	 * object is not in dictionary, create a new
    396 	 * sme event and assign required members.
    397 	 */
    398 register_event:
    399 	see = kmem_zalloc(sizeof(*see), KM_SLEEP);
    400 
    401 	mutex_enter(&sme_event_mtx);
    402 	see->critval = critval;
    403 	see->type = crittype;
    404 	(void)strlcpy(see->pes.pes_dvname, drvn,
    405 	    sizeof(see->pes.pes_dvname));
    406 	see->pes.pes_type = powertype;
    407 	(void)strlcpy(see->pes.pes_sensname, edata->desc,
    408 	    sizeof(see->pes.pes_sensname));
    409 	see->snum = edata->sensor;
    410 	mutex_exit(&sme_event_mtx);
    411 
    412 	if (sme_event_register(see)) {
    413 		kmem_free(see, sizeof(*see));
    414 		return EINVAL;
    415 	}
    416 
    417 out:
    418 	/* update the object in the dictionary */
    419 	if (objkey && critval) {
    420 		mutex_enter(&sme_event_mtx);
    421 		SENSOR_UPINT32(sdict, objkey, critval);
    422 		mutex_exit(&sme_event_mtx);
    423 	}
    424 
    425 	return error;
    426 }
    427 
    428 /*
    429  * sme_events_init:
    430  *
    431  * 	+ Initializes the callout and the workqueue to handle
    432  * 	  the sysmon envsys events.
    433  */
    434 int
    435 sme_events_init(void)
    436 {
    437 	int error;
    438 
    439 	error = workqueue_create(&seewq, "envsysev",
    440 	    sme_events_worker, NULL, 0, IPL_SOFTCLOCK, 0);
    441 	if (error)
    442 		goto out;
    443 
    444 	callout_init(&seeco, 0);
    445 	callout_setfunc(&seeco, sme_events_check, NULL);
    446 	callout_schedule(&seeco, SME_EVTIMO);
    447 	sme_events_initialized = true;
    448 	DPRINTF(("%s: events framework initialized\n", __func__));
    449 
    450 out:
    451 	return error;
    452 }
    453 
    454 /*
    455  * sme_events_check:
    456  *
    457  * 	+ Runs the work on each sysmon envsys event in our
    458  * 	  workqueue periodically with callout.
    459  */
    460 void
    461 sme_events_check(void *arg)
    462 {
    463 	sme_event_t *see;
    464 
    465 	LIST_FOREACH(see, &sme_events_list, see_list) {
    466 		DPRINTF(("%s: dev=%s sensor=%s type=%d\n",
    467 		    __func__,
    468 		    see->pes.pes_dvname,
    469 		    see->pes.pes_sensname,
    470 		    see->type));
    471 		workqueue_enqueue(seewq, &see->see_wk, NULL);
    472 	}
    473 	callout_schedule(&seeco, SME_EVTIMO);
    474 }
    475 
    476 /*
    477  * sme_events_worker:
    478  *
    479  * 	+ workqueue thread that checks if there's a critical condition
    480  * 	  and sends an event if the condition was triggered.
    481  */
    482 void
    483 sme_events_worker(struct work *wk, void *arg)
    484 {
    485 	const struct sme_sensor_state *esds = sme_sensor_drive_state;
    486 	const struct sme_sensor_event *sse = sme_sensor_event;
    487 	sme_event_t *see = (void *)wk;
    488 	struct sysmon_envsys *sme;
    489 	envsys_data_t *edata;
    490 	int d, i, error = 0;
    491 
    492 	KASSERT(wk == &see->see_wk);
    493 
    494 	/* XXX: NOT YET mutex_enter(&sme_event_mtx); */
    495 	/*
    496 	 * We have to find the sme device by looking
    497 	 * at the power envsys device name.
    498 	 */
    499 	LIST_FOREACH(sme, &sysmon_envsys_list, sme_list)
    500 		if (strcmp(sme->sme_name, see->pes.pes_dvname) == 0)
    501 			break;
    502 
    503 	KASSERT(sme != NULL);
    504 
    505 	/* get the sensor number in the sme event */
    506 	d = see->snum;
    507 	edata = &sme->sme_sensor_data[d];
    508 
    509 	/*
    510 	 * refresh the sensor that was marked with a critical
    511 	 * event.
    512 	 */
    513 	if ((sme->sme_flags & SME_DISABLE_GTREDATA) == 0) {
    514 		error = (*sme->sme_gtredata)(sme, edata);
    515 		if (error) {
    516 			/* XXX: NOT YET mutex_exit(&sme_event_mtx); */
    517 			return;
    518 		}
    519 	}
    520 
    521 	DPRINTF(("%s: desc=%s sensor=%d units=%d value_cur=%d\n",
    522 	    __func__, edata->desc, edata->sensor,
    523 	    edata->units, edata->value_cur));
    524 
    525 #define SME_SEND_NORMALEVENT()						\
    526 do {									\
    527 	see->evsent = false;						\
    528 	sysmon_penvsys_event(&see->pes, PENVSYS_EVENT_NORMAL);		\
    529 } while (/* CONSTCOND */ 0)
    530 
    531 #define SME_SEND_EVENT(type)						\
    532 do {									\
    533 	see->evsent = true;						\
    534 	sysmon_penvsys_event(&see->pes, (type));			\
    535 } while (/* CONSTCOND */ 0)
    536 
    537 	switch (see->type) {
    538 	/*
    539 	 * if state is the same than the one that matches sse[i].state,
    540 	 * send the event...
    541 	 */
    542 	case PENVSYS_EVENT_CRITICAL:
    543 	case PENVSYS_EVENT_CRITUNDER:
    544 	case PENVSYS_EVENT_CRITOVER:
    545 	case PENVSYS_EVENT_WARNUNDER:
    546 	case PENVSYS_EVENT_WARNOVER:
    547 		for (i = 0; sse[i].state != -1; i++)
    548 			if (sse[i].event == see->type)
    549 				break;
    550 
    551 		if (see->evsent && edata->state == ENVSYS_SVALID)
    552 			SME_SEND_NORMALEVENT();
    553 
    554 		if (!see->evsent && edata->state == sse[i].state)
    555 			SME_SEND_EVENT(see->type);
    556 
    557 		break;
    558 	/*
    559 	 * if value_cur is lower than the limit, send the event...
    560 	 */
    561 	case PENVSYS_EVENT_BATT_USERCAP:
    562 	case PENVSYS_EVENT_USER_CRITMIN:
    563 		if (see->evsent && edata->value_cur > see->critval)
    564 			SME_SEND_NORMALEVENT();
    565 
    566 		if (!see->evsent && edata->value_cur < see->critval)
    567 			SME_SEND_EVENT(see->type);
    568 
    569 		break;
    570 	/*
    571 	 * if value_cur is higher than the limit, send the event...
    572 	 */
    573 	case PENVSYS_EVENT_USER_CRITMAX:
    574 		if (see->evsent && edata->value_cur < see->critval)
    575 			SME_SEND_NORMALEVENT();
    576 
    577 		if (!see->evsent && edata->value_cur > see->critval)
    578 			SME_SEND_EVENT(see->type);
    579 
    580 		break;
    581 	/*
    582 	 * if value_cur is not ENVSYS_DRIVE_ONLINE, send the event...
    583 	 */
    584 	case PENVSYS_EVENT_DRIVE_STCHANGED:
    585 		/* the state has not been changed, just ignore the event */
    586 		if (edata->value_cur == see->evsent)
    587 			break;
    588 
    589 		for (i = 0; esds[i].type != -1; i++)
    590 			if (esds[i].type == edata->value_cur)
    591 				break;
    592 
    593 		/* copy current state description  */
    594 		(void)strlcpy(see->pes.pes_statedesc, esds[i].desc,
    595 		    sizeof(see->pes.pes_statedesc));
    596 
    597 		/* state is ok again... send a normal event */
    598 		if (see->evsent && edata->value_cur == ENVSYS_DRIVE_ONLINE)
    599 			SME_SEND_NORMALEVENT();
    600 
    601 		/* something bad happened to the drive... send the event */
    602 		if (see->evsent || edata->value_cur != ENVSYS_DRIVE_ONLINE) {
    603 			/* save current drive state */
    604 			see->evsent = edata->value_cur;
    605 			sysmon_penvsys_event(&see->pes, see->type);
    606 		}
    607 
    608 		break;
    609 	}
    610 	/* XXX: NOT YET mutex_exit(&sme_event_mtx); */
    611 }
    612