From owner-svn-src-stable@freebsd.org Thu Jun 22 18:40:35 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DBAACD92527; Thu, 22 Jun 2017 18:40:35 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B737BFD8; Thu, 22 Jun 2017 18:40:35 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5MIeYkU066041; Thu, 22 Jun 2017 18:40:34 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5MIeYEr066038; Thu, 22 Jun 2017 18:40:34 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201706221840.v5MIeYEr066038@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 22 Jun 2017 18:40:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r320241 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Jun 2017 18:40:36 -0000 Author: markj Date: Thu Jun 22 18:40:34 2017 New Revision: 320241 URL: https://svnweb.freebsd.org/changeset/base/320241 Log: MFC r320124: Fix the !TD_IS_IDLETHREAD(curthread) locking assertions. Approved by: re (kib) Modified: stable/11/sys/kern/kern_mutex.c stable/11/sys/kern/kern_rwlock.c stable/11/sys/kern/kern_sx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_mutex.c ============================================================================== --- stable/11/sys/kern/kern_mutex.c Thu Jun 22 18:39:52 2017 (r320240) +++ stable/11/sys/kern/kern_mutex.c Thu Jun 22 18:40:34 2017 (r320241) @@ -233,7 +233,8 @@ __mtx_lock_flags(volatile uintptr_t *c, int opts, cons m = mtxlock2mtx(c); - KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(curthread), + KASSERT(kdb_active != 0 || SCHEDULER_STOPPED() || + !TD_IS_IDLETHREAD(curthread), ("mtx_lock() by idle thread %p on sleep mutex %s @ %s:%d", curthread, m->lock_object.lo_name, file, line)); KASSERT(m->mtx_lock != MTX_DESTROYED, @@ -390,7 +391,7 @@ _mtx_trylock_flags_(volatile uintptr_t *c, int opts, c m = mtxlock2mtx(c); - KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(curthread), + KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(td), ("mtx_trylock() by idle thread %p on sleep mutex %s @ %s:%d", curthread, m->lock_object.lo_name, file, line)); KASSERT(m->mtx_lock != MTX_DESTROYED, Modified: stable/11/sys/kern/kern_rwlock.c ============================================================================== --- stable/11/sys/kern/kern_rwlock.c Thu Jun 22 18:39:52 2017 (r320240) +++ stable/11/sys/kern/kern_rwlock.c Thu Jun 22 18:40:34 2017 (r320241) @@ -269,7 +269,8 @@ _rw_wlock_cookie(volatile uintptr_t *c, const char *fi rw = rwlock2rw(c); - KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(curthread), + KASSERT(kdb_active != 0 || SCHEDULER_STOPPED() || + !TD_IS_IDLETHREAD(curthread), ("rw_wlock() by idle thread %p on rwlock %s @ %s:%d", curthread, rw->lock_object.lo_name, file, line)); KASSERT(rw->rw_lock != RW_DESTROYED, @@ -305,7 +306,7 @@ __rw_try_wlock(volatile uintptr_t *c, const char *file rw = rwlock2rw(c); - KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(curthread), + KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(td), ("rw_try_wlock() by idle thread %p on rwlock %s @ %s:%d", curthread, rw->lock_object.lo_name, file, line)); KASSERT(rw->rw_lock != RW_DESTROYED, @@ -615,7 +616,8 @@ __rw_rlock(volatile uintptr_t *c, const char *file, in td = curthread; rw = rwlock2rw(c); - KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(td), + KASSERT(kdb_active != 0 || SCHEDULER_STOPPED_TD(td) || + !TD_IS_IDLETHREAD(td), ("rw_rlock() by idle thread %p on rwlock %s @ %s:%d", td, rw->lock_object.lo_name, file, line)); KASSERT(rw->rw_lock != RW_DESTROYED, @@ -815,7 +817,6 @@ _rw_runlock_cookie(volatile uintptr_t *c, const char * TD_LOCKS_DEC(curthread); } - /* * This function is called when we are unable to obtain a write lock on the Modified: stable/11/sys/kern/kern_sx.c ============================================================================== --- stable/11/sys/kern/kern_sx.c Thu Jun 22 18:39:52 2017 (r320240) +++ stable/11/sys/kern/kern_sx.c Thu Jun 22 18:40:34 2017 (r320241) @@ -293,7 +293,8 @@ _sx_xlock(struct sx *sx, int opts, const char *file, i uintptr_t tid, x; int error = 0; - KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(curthread), + KASSERT(kdb_active != 0 || SCHEDULER_STOPPED() || + !TD_IS_IDLETHREAD(curthread), ("sx_xlock() by idle thread %p on sx %s @ %s:%d", curthread, sx->lock_object.lo_name, file, line)); KASSERT(sx->sx_lock != SX_LOCK_DESTROYED, @@ -330,7 +331,7 @@ sx_try_xlock_(struct sx *sx, const char *file, int lin if (SCHEDULER_STOPPED_TD(td)) return (1); - KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(curthread), + KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(td), ("sx_try_xlock() by idle thread %p on sx %s @ %s:%d", curthread, sx->lock_object.lo_name, file, line)); KASSERT(sx->sx_lock != SX_LOCK_DESTROYED, @@ -1028,7 +1029,8 @@ _sx_slock(struct sx *sx, int opts, const char *file, i uintptr_t x; int error; - KASSERT(kdb_active != 0 || !TD_IS_IDLETHREAD(curthread), + KASSERT(kdb_active != 0 || SCHEDULER_STOPPED() || + !TD_IS_IDLETHREAD(curthread), ("sx_slock() by idle thread %p on sx %s @ %s:%d", curthread, sx->lock_object.lo_name, file, line)); KASSERT(sx->sx_lock != SX_LOCK_DESTROYED,