Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/sysmon Kill sme_callout_mtx and use sme_mtx instead



details:   https://anonhg.NetBSD.org/src/rev/bb864a9db785
branches:  trunk
changeset: 804071:bb864a9db785
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Sat Nov 22 15:00:05 2014 +0000

description:
Kill sme_callout_mtx and use sme_mtx instead

We can use sme_mtx for the callout as well. Actually we should do so
because sme_events_list and some other data that are touched in the
callout should be protected by sme_mtx, not sme_callout_mtx.

Discussed with riastradh@ in http://mail-index.netbsd.org/tech-kern/2014/11/11/msg017956.html

diffstat:

 sys/dev/sysmon/sysmon_envsys_events.c |  10 ++++------
 sys/dev/sysmon/sysmonvar.h            |   3 +--
 2 files changed, 5 insertions(+), 8 deletions(-)

diffs (68 lines):

diff -r b74371523f25 -r bb864a9db785 sys/dev/sysmon/sysmon_envsys_events.c
--- a/sys/dev/sysmon/sysmon_envsys_events.c     Sat Nov 22 14:31:53 2014 +0000
+++ b/sys/dev/sysmon/sysmon_envsys_events.c     Sat Nov 22 15:00:05 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sysmon_envsys_events.c,v 1.110 2013/09/15 14:40:56 martin Exp $ */
+/* $NetBSD: sysmon_envsys_events.c,v 1.111 2014/11/22 15:00:05 ozaki-r Exp $ */
 
 /*-
  * Copyright (c) 2007, 2008 Juan Romero Pardines.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys_events.c,v 1.110 2013/09/15 14:40:56 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys_events.c,v 1.111 2014/11/22 15:00:05 ozaki-r Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -566,7 +566,6 @@
        if (error)
                return error;
 
-       mutex_init(&sme->sme_callout_mtx, MUTEX_DEFAULT, IPL_SOFTCLOCK);
        callout_init(&sme->sme_callout, CALLOUT_MPSAFE);
        callout_setfunc(&sme->sme_callout, sme_events_check, sme);
        sme->sme_flags |= SME_CALLOUT_INITIALIZED;
@@ -614,7 +613,6 @@
 
        callout_stop(&sme->sme_callout);
        workqueue_destroy(sme->sme_wq);
-       mutex_destroy(&sme->sme_callout_mtx);
        callout_destroy(&sme->sme_callout);
        sme->sme_flags &= ~SME_CALLOUT_INITIALIZED;
        DPRINTF(("%s: events framework destroyed for '%s'\n",
@@ -708,14 +706,14 @@
 
        KASSERT(sme != NULL);
 
-       mutex_enter(&sme->sme_callout_mtx);
+       mutex_enter(&sme->sme_mtx);
        LIST_FOREACH(see, &sme->sme_events_list, see_list) {
                workqueue_enqueue(sme->sme_wq, &see->see_wk, NULL);
                see->see_edata->flags |= ENVSYS_FNEED_REFRESH;
        }
        if (!sysmon_low_power)
                sme_schedule_callout(sme);
-       mutex_exit(&sme->sme_callout_mtx);
+       mutex_exit(&sme->sme_mtx);
 }
 
 /*
diff -r b74371523f25 -r bb864a9db785 sys/dev/sysmon/sysmonvar.h
--- a/sys/dev/sysmon/sysmonvar.h        Sat Nov 22 14:31:53 2014 +0000
+++ b/sys/dev/sysmon/sysmonvar.h        Sat Nov 22 15:00:05 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sysmonvar.h,v 1.44 2012/12/11 15:39:06 pgoyette Exp $  */
+/*     $NetBSD: sysmonvar.h,v 1.45 2014/11/22 15:00:05 ozaki-r Exp $   */
 
 /*-
  * Copyright (c) 2000 Zembu Labs, Inc.
@@ -208,7 +208,6 @@
         * Locking/synchronization.
         */
        kmutex_t sme_mtx;
-       kmutex_t sme_callout_mtx;
        kcondvar_t sme_condvar;
 };
 



Home | Main Index | Thread Index | Old Index