summaryrefslogtreecommitdiff
path: root/sys/dev/sysmon/sysmonvar.h
diff options
context:
space:
mode:
authorpgoyette <pgoyette@NetBSD.org>2017-09-11 06:02:09 +0000
committerpgoyette <pgoyette@NetBSD.org>2017-09-11 06:02:09 +0000
commit6c75b1eb5e6359b4d5a689f0807a3bc11d8befe8 (patch)
treeab98cb0679ecbfc1751e394c53df9e38bc275aa3 /sys/dev/sysmon/sysmonvar.h
parent0362de20498a718aeb5e475eab2d113a1a4860dc (diff)
Improve tracking of the state of an event's callout, and protect all
queries or modifications of the state with the sme_mtx mutex. Detach the rndsrc before re-attaching it (with potentially new values). Clean up some lock-ordering issues. And a couple of KNF issues for good measure! Should address PR kern/52533 XXX Pullup-8 along with the previous fixes from msaitoh@ XXX http://mail-index.netbsd.org/source-changes/2017/09/06/msg088028.html ~ ~
Diffstat (limited to 'sys/dev/sysmon/sysmonvar.h')
-rw-r--r--sys/dev/sysmon/sysmonvar.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/dev/sysmon/sysmonvar.h b/sys/dev/sysmon/sysmonvar.h
index b3dd29ed636..e31901485a2 100644
--- a/sys/dev/sysmon/sysmonvar.h
+++ b/sys/dev/sysmon/sysmonvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: sysmonvar.h,v 1.49 2015/04/23 23:22:03 pgoyette Exp $ */
+/* $NetBSD: sysmonvar.h,v 1.50 2017/09/11 06:02:09 pgoyette Exp $ */
/*-
* Copyright (c) 2000 Zembu Labs, Inc.
@@ -163,7 +163,6 @@ struct sysmon_envsys {
int sme_flags; /* additional flags */
#define SME_FLAG_BUSY 0x00000001 /* device busy */
#define SME_DISABLE_REFRESH 0x00000002 /* disable sme_refresh */
-#define SME_CALLOUT_INITIALIZED 0x00000004 /* callout was initialized */
#define SME_INIT_REFRESH 0x00000008 /* call sme_refresh() after
interrupts are enabled in
the autoconf(9) process. */
@@ -187,6 +186,12 @@ struct sysmon_envsys {
struct workqueue *sme_wq; /* the workqueue for the events */
struct callout sme_callout; /* for the events */
+ int sme_callout_state; /* state of the event's callout */
+
+#define SME_CALLOUT_INVALID 0x0 /* callout is not initialized */
+#define SME_CALLOUT_READY 0x1 /* callout is ready for use */
+#define SME_CALLOUT_HALTED 0x2 /* callout can be destroyed */
+
uint64_t sme_events_timeout; /* the timeout used in the callout */
/*