From afa39f7a32c9b2d6003b06fda5c4fc21ab199747 Mon Sep 17 00:00:00 2001 From: Mateusz Guzik Date: Fri, 17 Feb 2017 05:09:51 +0000 Subject: [PATCH] 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. --- sys/kern/kern_mutex.c | 6 ------ sys/kern/kern_rwlock.c | 6 ------ sys/kern/kern_sx.c | 4 ---- 3 files changed, 16 deletions(-) diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c index 581d99b711be..23b731b77880 100644 --- a/sys/kern/kern_mutex.c +++ b/sys/kern/kern_mutex.c @@ -231,9 +231,6 @@ __mtx_lock_flags(volatile uintptr_t *c, int opts, const char *file, int line) struct mtx *m; uintptr_t tid, v; - if (SCHEDULER_STOPPED()) - return; - m = mtxlock2mtx(c); KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(curthread), @@ -266,9 +263,6 @@ __mtx_unlock_flags(volatile uintptr_t *c, int opts, const char *file, int line) { struct mtx *m; - if (SCHEDULER_STOPPED()) - return; - m = mtxlock2mtx(c); KASSERT(m->mtx_lock != MTX_DESTROYED, diff --git a/sys/kern/kern_rwlock.c b/sys/kern/kern_rwlock.c index 9464588b9eda..fcb7d00c3d68 100644 --- a/sys/kern/kern_rwlock.c +++ b/sys/kern/kern_rwlock.c @@ -267,9 +267,6 @@ _rw_wlock_cookie(volatile uintptr_t *c, const char *file, int line) struct rwlock *rw; uintptr_t tid, v; - if (SCHEDULER_STOPPED()) - return; - rw = rwlock2rw(c); KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(curthread), @@ -335,9 +332,6 @@ _rw_wunlock_cookie(volatile uintptr_t *c, const char *file, int line) { struct rwlock *rw; - if (SCHEDULER_STOPPED()) - return; - rw = rwlock2rw(c); KASSERT(rw->rw_lock != RW_DESTROYED, diff --git a/sys/kern/kern_sx.c b/sys/kern/kern_sx.c index 96ca4dffef28..7162a1aa243e 100644 --- a/sys/kern/kern_sx.c +++ b/sys/kern/kern_sx.c @@ -295,8 +295,6 @@ _sx_xlock(struct sx *sx, int opts, const char *file, int line) uintptr_t tid, x; int error = 0; - if (SCHEDULER_STOPPED()) - return (0); KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(curthread), ("sx_xlock() by idle thread %p on sx %s @ %s:%d", curthread, sx->lock_object.lo_name, file, line)); @@ -360,8 +358,6 @@ void _sx_xunlock(struct sx *sx, const char *file, int line) { - if (SCHEDULER_STOPPED()) - return; KASSERT(sx->sx_lock != SX_LOCK_DESTROYED, ("sx_xunlock() of destroyed sx @ %s:%d", file, line)); _sx_assert(sx, SA_XLOCKED, file, line);