aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Certner <olce@FreeBSD.org>2024-01-18 10:31:59 +0000
committerOlivier Certner <olce@FreeBSD.org>2024-02-20 08:27:07 +0000
commita6d066d0120f0b83efca4e618050557a91259a30 (patch)
treec907fb993b04572f5cf8572a581c13bc6f3bf16a
parent261f70ffc8a85085c4bc3632818f77e60d4d076e (diff)
SCHEDULER_STOPPED(): Move it (back) to 'systm.h'
It's not an assertion, so doesn't logically belong to 'kassert.h'. Moreover, a subsequent commit will make it rely on a variable whose declaration also belongs to 'systm.h'. Approved by: markj (mentor) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D43571 (cherry picked from commit cd0c52e50bc17f4c3fab998f9f33b1d3ada6c90e) Approved by: markj (mentor)
-rw-r--r--sys/sys/kassert.h11
-rw-r--r--sys/sys/systm.h12
2 files changed, 12 insertions, 11 deletions
diff --git a/sys/sys/kassert.h b/sys/sys/kassert.h
index d7c1a21385f9..da7b66854a14 100644
--- a/sys/sys/kassert.h
+++ b/sys/sys/kassert.h
@@ -149,17 +149,6 @@ void kassert_panic(const char *fmt, ...) __printflike(1, 2);
#define CRITICAL_ASSERT(td) \
KASSERT((td)->td_critnest >= 1, ("Not in critical section"))
-/*
- * If we have already panic'd and this is the thread that called
- * panic(), then don't block on any mutexes but silently succeed.
- * Otherwise, the kernel will deadlock since the scheduler isn't
- * going to run the thread that holds any lock we need.
- */
-#define SCHEDULER_STOPPED_TD(td) ({ \
- MPASS((td) == curthread); \
- __predict_false((td)->td_stopsched); \
-})
-#define SCHEDULER_STOPPED() SCHEDULER_STOPPED_TD(curthread)
#endif /* _KERNEL */
#endif /* _SYS_KASSERT_H_ */
diff --git a/sys/sys/systm.h b/sys/sys/systm.h
index 9a0932e50dc9..3721db649a3d 100644
--- a/sys/sys/systm.h
+++ b/sys/sys/systm.h
@@ -101,6 +101,18 @@ struct ucred;
#include <sys/pcpu.h> /* curthread */
#include <sys/kpilite.h>
+/*
+ * If we have already panic'd and this is the thread that called
+ * panic(), then don't block on any mutexes but silently succeed.
+ * Otherwise, the kernel will deadlock since the scheduler isn't
+ * going to run the thread that holds any lock we need.
+ */
+#define SCHEDULER_STOPPED_TD(td) ({ \
+ MPASS((td) == curthread); \
+ __predict_false((td)->td_stopsched); \
+})
+#define SCHEDULER_STOPPED() SCHEDULER_STOPPED_TD(curthread)
+
extern int osreldate;
extern const void *zero_region; /* address space maps to a zeroed page */