The check to avoid a panic for contented rwlock(9) should be outside of
#ifdef DIAGNOSTIC.
ok?
Index: kern//kern_synch.c
===================================================================
RCS file: /cvs/src/sys/kern/kern_synch.c,v
retrieving revision 1.177
diff -u -p -r1.177 kern_synch.c
--- kern//kern_synch.c 4 Mar 2021 09:02:37 -0000 1.177
+++ kern//kern_synch.c 9 Sep 2021 15:01:07 -0000
@@ -556,7 +556,6 @@ wakeup_n(const volatile void *ident, int
qp = &slpque[LOOKUP(ident)];
for (p = TAILQ_FIRST(qp); p != NULL && n != 0; p = pnext) {
pnext = TAILQ_NEXT(p, p_runq);
-#ifdef DIAGNOSTIC
/*
* If the rwlock passed to rwsleep() is contended, the
* CPU will end up calling wakeup() between sleep_setup()
@@ -566,6 +565,7 @@ wakeup_n(const volatile void *ident, int
KASSERT(p->p_stat == SONPROC);
continue;
}
+#ifdef DIAGNOSTIC
if (p->p_stat != SSLEEP && p->p_stat != SSTOP)
panic("wakeup: p_stat is %d", (int)p->p_stat);
#endif