Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Jun 2010 12:09:12 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r209504 - stable/7/sys/kern
Message-ID:  <201006241209.o5OC9CNm082525@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Thu Jun 24 12:09:12 2010
New Revision: 209504
URL: http://svn.freebsd.org/changeset/base/209504

Log:
  MFC 208391:
  Assert that the thread passed to sched_bind() and sched_unbind() is
  curthread as those routines are only supported for curthread currently.

Modified:
  stable/7/sys/kern/sched_4bsd.c
  stable/7/sys/kern/sched_ule.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/kern/sched_4bsd.c
==============================================================================
--- stable/7/sys/kern/sched_4bsd.c	Thu Jun 24 12:08:50 2010	(r209503)
+++ stable/7/sys/kern/sched_4bsd.c	Thu Jun 24 12:09:12 2010	(r209504)
@@ -1345,9 +1345,8 @@ sched_bind(struct thread *td, int cpu)
 {
 	struct td_sched *ts;
 
-	THREAD_LOCK_ASSERT(td, MA_OWNED);
-	KASSERT(TD_IS_RUNNING(td),
-	    ("sched_bind: cannot bind non-running thread"));
+	THREAD_LOCK_ASSERT(td, MA_OWNED|MA_NOTRECURSED);
+	KASSERT(td == curthread, ("sched_bind: can only bind curthread"));
 
 	ts = td->td_sched;
 
@@ -1365,6 +1364,7 @@ void
 sched_unbind(struct thread* td)
 {
 	THREAD_LOCK_ASSERT(td, MA_OWNED);
+	KASSERT(td == curthread, ("sched_unbind: can only bind curthread"));
 	td->td_flags &= ~TDF_BOUND;
 }
 

Modified: stable/7/sys/kern/sched_ule.c
==============================================================================
--- stable/7/sys/kern/sched_ule.c	Thu Jun 24 12:08:50 2010	(r209503)
+++ stable/7/sys/kern/sched_ule.c	Thu Jun 24 12:09:12 2010	(r209504)
@@ -2574,6 +2574,7 @@ sched_bind(struct thread *td, int cpu)
 	struct td_sched *ts;
 
 	THREAD_LOCK_ASSERT(td, MA_OWNED|MA_NOTRECURSED);
+	KASSERT(td == curthread, ("sched_bind: can only bind curthread"));
 	ts = td->td_sched;
 	if (ts->ts_flags & TSF_BOUND)
 		sched_unbind(td);
@@ -2597,6 +2598,7 @@ sched_unbind(struct thread *td)
 	struct td_sched *ts;
 
 	THREAD_LOCK_ASSERT(td, MA_OWNED);
+	KASSERT(td == curthread, ("sched_unbind: can only bind curthread"));
 	ts = td->td_sched;
 	if ((ts->ts_flags & TSF_BOUND) == 0)
 		return;



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