summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvisa <visa@openbsd.org>2019-06-04 15:41:02 +0000
committervisa <visa@openbsd.org>2019-06-04 15:41:02 +0000
commit643f9e39659938c3aece9bbdd98de4b78b355d24 (patch)
tree8f7ac7d8dbc335b8ba4d4b69bcd4b5ccbbb8b471
parentRemove the unused pvh_attrs attribute from struct vm_page_md. (diff)
downloadwireguard-openbsd-643f9e39659938c3aece9bbdd98de4b78b355d24.tar.xz
wireguard-openbsd-643f9e39659938c3aece9bbdd98de4b78b355d24.zip
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