aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/subr_smr.c
diff options
context:
space:
mode:
authorJeff Roberson <jeff@FreeBSD.org>2020-02-13 20:50:21 +0000
committerJeff Roberson <jeff@FreeBSD.org>2020-02-13 20:50:21 +0000
commita4d50e49da8e636fee461f21bf3d377be8082153 (patch)
treecf2baebf57f56cd8e45a36fed19b3897c38ab002 /sys/kern/subr_smr.c
parent43fbd654516eb5ddfa2994d92b7dfd373192796e (diff)
downloadsrc-a4d50e49da8e636fee461f21bf3d377be8082153.tar.gz
src-a4d50e49da8e636fee461f21bf3d377be8082153.zip
Add more precise SMR entry asserts.
Notes
Notes: svn path=/head/; revision=357882
Diffstat (limited to 'sys/kern/subr_smr.c')
-rw-r--r--sys/kern/subr_smr.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/kern/subr_smr.c b/sys/kern/subr_smr.c
index bbbc5711c499..1ea7e5d871f0 100644
--- a/sys/kern/subr_smr.c
+++ b/sys/kern/subr_smr.c
@@ -193,8 +193,7 @@ smr_advance(smr_t smr)
/*
* It is illegal to enter while in an smr section.
*/
- KASSERT(curthread->td_critnest == 0,
- ("smr_advance: Not allowed in a critical section."));
+ SMR_ASSERT_NOT_ENTERED(smr);
/*
* Modifications not done in a smr section need to be visible
@@ -237,6 +236,8 @@ smr_advance_deferred(smr_t smr, int limit)
smr_seq_t goal;
smr_t csmr;
+ SMR_ASSERT_NOT_ENTERED(smr);
+
critical_enter();
csmr = zpcpu_get(smr);
if (++csmr->c_deferred >= limit) {
@@ -275,8 +276,8 @@ smr_poll(smr_t smr, smr_seq_t goal, bool wait)
/*
* It is illegal to enter while in an smr section.
*/
- KASSERT(!wait || curthread->td_critnest == 0,
- ("smr_poll: Blocking not allowed in a critical section."));
+ KASSERT(!wait || !SMR_ENTERED(smr),
+ ("smr_poll: Blocking not allowed in a SMR section."));
/*
* Use a critical section so that we can avoid ABA races