[Midnightbsd-cvs] src [9373] trunk/sys/kern: Remove all the checks on curthread != NULL with the exception of some MD
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sat Mar 4 15:23:52 EST 2017
Revision: 9373
http://svnweb.midnightbsd.org/src/?rev=9373
Author: laffer1
Date: 2017-03-04 15:23:52 -0500 (Sat, 04 Mar 2017)
Log Message:
-----------
Remove all the checks on curthread != NULL with the exception of some MD
trap checks (eg. printtrap()).
Generally this check is not needed anymore, as there is not a legitimate
case where curthread != NULL, after pcpu 0 area has been properly
initialized.
Modified Paths:
--------------
trunk/sys/kern/kern_condvar.c
trunk/sys/kern/kern_mutex.c
trunk/sys/kern/kern_rwlock.c
trunk/sys/kern/kern_sx.c
trunk/sys/kern/kern_thread.c
trunk/sys/kern/vfs_subr.c
Modified: trunk/sys/kern/kern_condvar.c
===================================================================
--- trunk/sys/kern/kern_condvar.c 2017-03-04 20:22:59 UTC (rev 9372)
+++ trunk/sys/kern/kern_condvar.c 2017-03-04 20:23:52 UTC (rev 9373)
@@ -50,7 +50,7 @@
* Common sanity checks for cv_wait* functions.
*/
#define CV_ASSERT(cvp, lock, td) do { \
- KASSERT((td) != NULL, ("%s: curthread NULL", __func__)); \
+ KASSERT((td) != NULL, ("%s: td NULL", __func__)); \
KASSERT(TD_IS_RUNNING(td), ("%s: not TDS_RUNNING", __func__)); \
KASSERT((cvp) != NULL, ("%s: cvp NULL", __func__)); \
KASSERT((lock) != NULL, ("%s: lock NULL", __func__)); \
Modified: trunk/sys/kern/kern_mutex.c
===================================================================
--- trunk/sys/kern/kern_mutex.c 2017-03-04 20:22:59 UTC (rev 9372)
+++ trunk/sys/kern/kern_mutex.c 2017-03-04 20:23:52 UTC (rev 9373)
@@ -199,7 +199,6 @@
if (SCHEDULER_STOPPED())
return;
- MPASS(curthread != NULL);
KASSERT(m->mtx_lock != MTX_DESTROYED,
("mtx_lock() of destroyed mutex @ %s:%d", file, line));
KASSERT(LOCK_CLASS(&m->lock_object) == &lock_class_mtx_sleep,
@@ -221,7 +220,6 @@
if (SCHEDULER_STOPPED())
return;
- MPASS(curthread != NULL);
KASSERT(m->mtx_lock != MTX_DESTROYED,
("mtx_unlock() of destroyed mutex @ %s:%d", file, line));
KASSERT(LOCK_CLASS(&m->lock_object) == &lock_class_mtx_sleep,
@@ -244,7 +242,6 @@
if (SCHEDULER_STOPPED())
return;
- MPASS(curthread != NULL);
KASSERT(m->mtx_lock != MTX_DESTROYED,
("mtx_lock_spin() of destroyed mutex @ %s:%d", file, line));
KASSERT(LOCK_CLASS(&m->lock_object) == &lock_class_mtx_spin,
@@ -268,7 +265,6 @@
if (SCHEDULER_STOPPED())
return;
- MPASS(curthread != NULL);
KASSERT(m->mtx_lock != MTX_DESTROYED,
("mtx_unlock_spin() of destroyed mutex @ %s:%d", file, line));
KASSERT(LOCK_CLASS(&m->lock_object) == &lock_class_mtx_spin,
@@ -299,7 +295,6 @@
if (SCHEDULER_STOPPED())
return (1);
- MPASS(curthread != NULL);
KASSERT(m->mtx_lock != MTX_DESTROYED,
("mtx_trylock() of destroyed mutex @ %s:%d", file, line));
KASSERT(LOCK_CLASS(&m->lock_object) == &lock_class_mtx_sleep,
Modified: trunk/sys/kern/kern_rwlock.c
===================================================================
--- trunk/sys/kern/kern_rwlock.c 2017-03-04 20:22:59 UTC (rev 9372)
+++ trunk/sys/kern/kern_rwlock.c 2017-03-04 20:23:52 UTC (rev 9373)
@@ -237,7 +237,6 @@
if (SCHEDULER_STOPPED())
return;
- MPASS(curthread != NULL);
KASSERT(rw->rw_lock != RW_DESTROYED,
("rw_wlock() of destroyed rwlock @ %s:%d", file, line));
WITNESS_CHECKORDER(&rw->lock_object, LOP_NEWORDER | LOP_EXCLUSIVE, file,
@@ -282,7 +281,6 @@
if (SCHEDULER_STOPPED())
return;
- MPASS(curthread != NULL);
KASSERT(rw->rw_lock != RW_DESTROYED,
("rw_wunlock() of destroyed rwlock @ %s:%d", file, line));
_rw_assert(rw, RA_WLOCKED, file, line);
Modified: trunk/sys/kern/kern_sx.c
===================================================================
--- trunk/sys/kern/kern_sx.c 2017-03-04 20:22:59 UTC (rev 9372)
+++ trunk/sys/kern/kern_sx.c 2017-03-04 20:23:52 UTC (rev 9373)
@@ -246,7 +246,6 @@
if (SCHEDULER_STOPPED())
return (0);
- MPASS(curthread != NULL);
KASSERT(sx->sx_lock != SX_LOCK_DESTROYED,
("sx_slock() of destroyed sx @ %s:%d", file, line));
WITNESS_CHECKORDER(&sx->lock_object, LOP_NEWORDER, file, line, NULL);
@@ -293,7 +292,6 @@
if (SCHEDULER_STOPPED())
return (0);
- MPASS(curthread != NULL);
KASSERT(sx->sx_lock != SX_LOCK_DESTROYED,
("sx_xlock() of destroyed sx @ %s:%d", file, line));
WITNESS_CHECKORDER(&sx->lock_object, LOP_NEWORDER | LOP_EXCLUSIVE, file,
@@ -317,7 +315,6 @@
if (SCHEDULER_STOPPED())
return (1);
- MPASS(curthread != NULL);
KASSERT(sx->sx_lock != SX_LOCK_DESTROYED,
("sx_try_xlock() of destroyed sx @ %s:%d", file, line));
@@ -345,7 +342,6 @@
if (SCHEDULER_STOPPED())
return;
- MPASS(curthread != NULL);
KASSERT(sx->sx_lock != SX_LOCK_DESTROYED,
("sx_sunlock() of destroyed sx @ %s:%d", file, line));
_sx_assert(sx, SA_SLOCKED, file, line);
@@ -362,7 +358,6 @@
if (SCHEDULER_STOPPED())
return;
- MPASS(curthread != NULL);
KASSERT(sx->sx_lock != SX_LOCK_DESTROYED,
("sx_xunlock() of destroyed sx @ %s:%d", file, line));
_sx_assert(sx, SA_XLOCKED, file, line);
Modified: trunk/sys/kern/kern_thread.c
===================================================================
--- trunk/sys/kern/kern_thread.c 2017-03-04 20:22:59 UTC (rev 9372)
+++ trunk/sys/kern/kern_thread.c 2017-03-04 20:23:52 UTC (rev 9373)
@@ -623,7 +623,6 @@
p = td->td_proc;
mtx_assert(&Giant, MA_NOTOWNED);
PROC_LOCK_ASSERT(p, MA_OWNED);
- KASSERT((td != NULL), ("curthread is NULL"));
if ((p->p_flag & P_HADTHREADS) == 0)
return (0);
Modified: trunk/sys/kern/vfs_subr.c
===================================================================
--- trunk/sys/kern/vfs_subr.c 2017-03-04 20:22:59 UTC (rev 9372)
+++ trunk/sys/kern/vfs_subr.c 2017-03-04 20:23:52 UTC (rev 9373)
@@ -3494,7 +3494,6 @@
struct thread *td;
int error;
- KASSERT(curthread != NULL, ("vfs_unmountall: NULL curthread"));
CTR1(KTR_VFS, "%s: unmounting all filesystems", __func__);
td = curthread;
More information about the Midnightbsd-cvs
mailing list