summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVisa Hankala <visa@cvs.openbsd.org>2019-05-17 03:53:09 +0000
committerVisa Hankala <visa@cvs.openbsd.org>2019-05-17 03:53:09 +0000
commitb2ed2ef300bb0d91608b12afd90409a635474b51 (patch)
treec213e7aff981217963d4cf521b3e35866c9b48f0
parentca12f02bc5db7384cbdf36cbc74511ea7e21ae64 (diff)
Add SMR_ASSERT_NONCRITICAL() in assertwaitok(). This eases debugging
because now the error is detected before context switch. The sleep code path eventually calls assertwaitok() in mi_switch(), so the assertwaitok() in the SMR barrier function is somewhat redundant and can be removed. OK mpi@
-rw-r--r--sys/kern/kern_smr.c5
-rw-r--r--sys/kern/subr_xxx.c4
2 files changed, 4 insertions, 5 deletions
diff --git a/sys/kern/kern_smr.c b/sys/kern/kern_smr.c
index 50e378c1d2d..96cf9ca5cdc 100644
--- a/sys/kern/kern_smr.c
+++ b/sys/kern/kern_smr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_smr.c,v 1.3 2019/05/16 13:52:47 visa Exp $ */
+/* $OpenBSD: kern_smr.c,v 1.4 2019/05/17 03:53:08 visa Exp $ */
/*
* Copyright (c) 2019 Visa Hankala
@@ -287,9 +287,6 @@ smr_barrier_impl(int expedite)
if (panicstr != NULL || db_active)
return;
- assertwaitok();
- SMR_ASSERT_NONCRITICAL();
-
WITNESS_CHECKORDER(&smr_lock_obj, LOP_NEWORDER, NULL);
smr_init(&smr);
diff --git a/sys/kern/subr_xxx.c b/sys/kern/subr_xxx.c
index 0ecc0b060f2..5b63564e1a0 100644
--- a/sys/kern/subr_xxx.c
+++ b/sys/kern/subr_xxx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_xxx.c,v 1.16 2018/04/03 08:58:05 mpi Exp $ */
+/* $OpenBSD: subr_xxx.c,v 1.17 2019/05/17 03:53:08 visa Exp $ */
/* $NetBSD: subr_xxx.c,v 1.10 1996/02/04 02:16:51 christos Exp $ */
/*
@@ -39,6 +39,7 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
+#include <sys/smr.h>
/*
@@ -159,6 +160,7 @@ assertwaitok(void)
return;
splassert(IPL_NONE);
+ SMR_ASSERT_NONCRITICAL();
#ifdef DIAGNOSTIC
if (curcpu()->ci_mutex_level != 0)
panic("assertwaitok: non-zero mutex count: %d",