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
This commit is contained in:
Olivier Certner 2024-01-18 11:31:59 +01:00
parent 12d6a032df
commit cd0c52e50b
No known key found for this signature in database
GPG key ID: 8CA13040971E2627
2 changed files with 12 additions and 11 deletions

View file

@ -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_ */

View file

@ -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 */