git: a6d066d0120f - stable/14 - SCHEDULER_STOPPED(): Move it (back) to 'systm.h'
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 20 Feb 2024 08:27:59 UTC
The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=a6d066d0120f0b83efca4e618050557a91259a30 commit a6d066d0120f0b83efca4e618050557a91259a30 Author: Olivier Certner <olce@FreeBSD.org> AuthorDate: 2024-01-18 10:31:59 +0000 Commit: Olivier Certner <olce@FreeBSD.org> CommitDate: 2024-02-20 08:27:07 +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 (cherry picked from commit cd0c52e50bc17f4c3fab998f9f33b1d3ada6c90e) Approved by: markj (mentor) --- 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 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 */