diff options
author | mjg <mjg@FreeBSD.org> | 2017-03-16 07:10:08 +0000 |
---|---|---|
committer | mjg <mjg@FreeBSD.org> | 2017-03-16 07:10:08 +0000 |
commit | d560998145104e143fe539bc7194c2557691161d (patch) | |
tree | 8af038911b6e39c7f98e0481e057729f3c6b7e4f /sys/sys | |
parent | ba8e3c63addef8be003258061213f002a9a7ff43 (diff) | |
download | FreeBSD-src-d560998145104e143fe539bc7194c2557691161d.zip FreeBSD-src-d560998145104e143fe539bc7194c2557691161d.tar.gz |
MFC r313853,r313859:
locks: remove SCHEDULER_STOPPED checks from primitives for modules
They all fallback to the slow path if necessary and the check is there.
This means a panicked kernel executing code from modules will be able to
succeed doing actual lock/unlock, but this was already the case for core code
which has said primitives inlined.
==
Introduce SCHEDULER_STOPPED_TD for use when the thread pointer was already read
Sprinkle in few places.
Diffstat (limited to 'sys/sys')
-rw-r--r-- | sys/sys/systm.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 02c5db8..515a048 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -128,7 +128,11 @@ void kassert_panic(const char *fmt, ...) __printflike(1, 2); * Otherwise, the kernel will deadlock since the scheduler isn't * going to run the thread that holds any lock we need. */ -#define SCHEDULER_STOPPED() __predict_false(curthread->td_stopsched) +#define SCHEDULER_STOPPED_TD(td) ({ \ + MPASS((td) == curthread); \ + __predict_false((td)->td_stopsched); \ +}) +#define SCHEDULER_STOPPED() SCHEDULER_STOPPED_TD(curthread) /* * Align variables. |