svn commit: r313853 - head/sys/kern

Mateusz Guzik mjg at FreeBSD.org
Fri Feb 17 05:09:53 UTC 2017


Author: mjg
Date: Fri Feb 17 05:09:51 2017
New Revision: 313853
URL: https://svnweb.freebsd.org/changeset/base/313853

Log:
  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.

Modified:
  head/sys/kern/kern_mutex.c
  head/sys/kern/kern_rwlock.c
  head/sys/kern/kern_sx.c

Modified: head/sys/kern/kern_mutex.c
==============================================================================
--- head/sys/kern/kern_mutex.c	Fri Feb 17 04:34:17 2017	(r313852)
+++ head/sys/kern/kern_mutex.c	Fri Feb 17 05:09:51 2017	(r313853)
@@ -231,9 +231,6 @@ __mtx_lock_flags(volatile uintptr_t *c, 
 	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
 {
 	struct mtx *m;
 
-	if (SCHEDULER_STOPPED())
-		return;
-
 	m = mtxlock2mtx(c);
 
 	KASSERT(m->mtx_lock != MTX_DESTROYED,

Modified: head/sys/kern/kern_rwlock.c
==============================================================================
--- head/sys/kern/kern_rwlock.c	Fri Feb 17 04:34:17 2017	(r313852)
+++ head/sys/kern/kern_rwlock.c	Fri Feb 17 05:09:51 2017	(r313853)
@@ -267,9 +267,6 @@ _rw_wlock_cookie(volatile uintptr_t *c, 
 	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
 {
 	struct rwlock *rw;
 
-	if (SCHEDULER_STOPPED())
-		return;
-
 	rw = rwlock2rw(c);
 
 	KASSERT(rw->rw_lock != RW_DESTROYED,

Modified: head/sys/kern/kern_sx.c
==============================================================================
--- head/sys/kern/kern_sx.c	Fri Feb 17 04:34:17 2017	(r313852)
+++ head/sys/kern/kern_sx.c	Fri Feb 17 05:09:51 2017	(r313853)
@@ -295,8 +295,6 @@ _sx_xlock(struct sx *sx, int opts, const
 	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);


More information about the svn-src-head mailing list