git: cd0c52e50bc1 - main - SCHEDULER_STOPPED(): Move it (back) to 'systm.h'
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 26 Jan 2024 21:11:29 UTC
The branch main has been updated by olce:
URL: https://cgit.FreeBSD.org/src/commit/?id=cd0c52e50bc17f4c3fab998f9f33b1d3ada6c90e
commit cd0c52e50bc17f4c3fab998f9f33b1d3ada6c90e
Author: Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2024-01-18 10:31:59 +0000
Commit: Olivier Certner <olce@FreeBSD.org>
CommitDate: 2024-01-26 21:09:16 +0000
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
---
sys/sys/kassert.h | 11 -----------
sys/sys/systm.h | 12 ++++++++++++
2 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/sys/sys/kassert.h b/sys/sys/kassert.h
index da8701ce3858..25e2b025a11a 100644
--- a/sys/sys/kassert.h
+++ b/sys/sys/kassert.h
@@ -179,17 +179,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 c684f3365c35..0d3f9fe98893 100644
--- a/sys/sys/systm.h
+++ b/sys/sys/systm.h
@@ -99,6 +99,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 */