Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 Jun 2002 18:54:57 -0700 (PDT)
From:      Matt Dillon <dillon@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 13298 for review
Message-ID:  <200206230154.g5N1svF96517@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=13298

Change 13298 by dillon@apollo on 2002/06/22 18:54:12

	Reorder scheduler mutex around SUSPEND.  Adjust kasserts.

Affected files ...

... //depot/projects/kse/sys/kern/kern_thread.c#76 edit

Differences ...

==== //depot/projects/kse/sys/kern/kern_thread.c#76 (text+ko) ====

@@ -313,10 +313,12 @@
 
 	/* Reassign this thread's KSE. */
 	if (ke != NULL) {
-KASSERT((ke->ke_state != KES_ONRUNQ), ("zapping kse on run queue"));
-KASSERT((ke->ke_thread->td_state != TDS_RUNQ), ("zapping thread on run queue"));
+KASSERT((ke->ke_state == KES_RUNNING), ("zapping kse not running"));
+KASSERT((ke->ke_thread == td ), ("kse ke_thread mismatch against curthread"));
+KASSERT((ke->ke_thread->td_state == TDS_RUNNING), ("zapping thread not running"));
 		ke->ke_thread = NULL;
 		td->td_kse = NULL;
+		mtx_assert(&sched_lock, MA_OWNED);
 		ke->ke_state = KES_UNQUEUED;
 		kse_reassign(ke);
 	}
@@ -483,10 +485,10 @@
 		 * Wake us up when everyone else has suspended.
 		 * (or died)
 		 */
+		mtx_lock_spin(&sched_lock);
 		TAILQ_INSERT_TAIL(&p->p_suspended, td, td_runq);
 		td->td_state = TDS_SUSPENDED;
 		p->p_suspcount++;
-		mtx_lock_spin(&sched_lock);
 		mtx_unlock(&Giant);
 		PROC_UNLOCK(p);
 		mi_switch();
@@ -585,10 +587,11 @@
 		 * (lent kse's can not go back to userland?)
 		 * and can only be lent in STOPPED state.
 		 */
+		mtx_assert(&Giant, MA_NOTOWNED);
+		mtx_lock_spin(&sched_lock);
 		p->p_suspcount++;
 		td->td_state = TDS_SUSPENDED;
 		TAILQ_INSERT_TAIL(&p->p_suspended, td, td_runq);
-		mtx_lock_spin(&sched_lock);
 		PROC_UNLOCK(p);
 		mi_switch();
 		mtx_unlock_spin(&sched_lock);

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200206230154.g5N1svF96517>