summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVisa Hankala <visa@cvs.openbsd.org>2019-06-04 15:41:03 +0000
committerVisa Hankala <visa@cvs.openbsd.org>2019-06-04 15:41:03 +0000
commit8dd8ecb0cb1332bd8a09c9c3b25d2e7b8ab29864 (patch)
tree7b5c86c77a04998b35f0313665fefd3462946303
parent9caec1e7dcb8972d69d945561fbe9ac0953d31bb (diff)
Let SP kernel work with WITNESS. The necessary instrumentation was
missing from the SP variant of mtx_enter() and mtx_enter_try(). mtx_leave() was correct already. Prompted by and OK patrick@
-rw-r--r--sys/kern/kern_lock.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c
index a91c6cc47e3..ef5aa3f6029 100644
--- a/sys/kern/kern_lock.c
+++ b/sys/kern/kern_lock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_lock.c,v 1.69 2019/04/23 13:35:12 visa Exp $ */
+/* $OpenBSD: kern_lock.c,v 1.70 2019/06/04 15:41:02 visa Exp $ */
/*
* Copyright (c) 2017 Visa Hankala
@@ -321,6 +321,9 @@ mtx_enter(struct mutex *mtx)
if (panicstr || db_active)
return;
+ WITNESS_CHECKORDER(MUTEX_LOCK_OBJECT(mtx),
+ LOP_EXCLUSIVE | LOP_NEWORDER, NULL);
+
#ifdef DIAGNOSTIC
if (__predict_false(mtx->mtx_owner == ci))
panic("mtx %p: locking against myself", mtx);
@@ -334,6 +337,7 @@ mtx_enter(struct mutex *mtx)
#ifdef DIAGNOSTIC
ci->ci_mutex_level++;
#endif
+ WITNESS_LOCK(MUTEX_LOCK_OBJECT(mtx), LOP_EXCLUSIVE);
}
int