summaryrefslogtreecommitdiffstats
path: root/sys/sys/sched.h
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2017-12-04 09:51:03 +0000
committermpi <mpi@openbsd.org>2017-12-04 09:51:03 +0000
commitba0fc568d9c35fb642d91e327e264398ac267760 (patch)
tree9920a8689fecd30310e986c8b53aee80be325a36 /sys/sys/sched.h
parentUse _kernel_lock_held() instead of __mp_lock_held(&kernel_lock). (diff)
downloadwireguard-openbsd-ba0fc568d9c35fb642d91e327e264398ac267760.tar.xz
wireguard-openbsd-ba0fc568d9c35fb642d91e327e264398ac267760.zip
Change __mp_lock_held() to work with an arbitrary CPU info structure and
extend ddb(4) "ps /o" output to print which CPU is currently holding the KERNEL_LOCK(). Tested by dhill@, ok visa@
Diffstat (limited to 'sys/sys/sched.h')
-rw-r--r--sys/sys/sched.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/sys/sched.h b/sys/sys/sched.h
index 0ae777f0d19..0da1f2c9afd 100644
--- a/sys/sys/sched.h
+++ b/sys/sys/sched.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sched.h,v 1.42 2017/02/14 10:31:15 mpi Exp $ */
+/* $OpenBSD: sched.h,v 1.43 2017/12/04 09:51:03 mpi Exp $ */
/* $NetBSD: sched.h,v 1.2 1999/02/28 18:14:58 ross Exp $ */
/*-
@@ -199,9 +199,12 @@ extern struct __mp_lock sched_lock;
#define SCHED_ASSERT_LOCKED() \
do { \
splassert(IPL_SCHED); \
- KASSERT(__mp_lock_held(&sched_lock)); \
+ KASSERT(__mp_lock_held(&sched_lock, curcpu())); \
+} while (0)
+#define SCHED_ASSERT_UNLOCKED() \
+do { \
+ KASSERT(__mp_lock_held(&sched_lock, curcpu()) == 0); \
} while (0)
-#define SCHED_ASSERT_UNLOCKED() KASSERT(__mp_lock_held(&sched_lock) == 0)
#define SCHED_LOCK_INIT() __mp_lock_init(&sched_lock)