Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Aug 2012 20:01:39 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r239585 - head/sys/kern
Message-ID:  <201208222001.q7MK1dBu089235@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Wed Aug 22 20:01:38 2012
New Revision: 239585
URL: http://svn.freebsd.org/changeset/base/239585

Log:
  Mark the idle threads as non-sleepable and also assert that an idle
  thread never blocks on a turnstile.

Modified:
  head/sys/kern/sched_4bsd.c
  head/sys/kern/sched_ule.c
  head/sys/kern/subr_turnstile.c

Modified: head/sys/kern/sched_4bsd.c
==============================================================================
--- head/sys/kern/sched_4bsd.c	Wed Aug 22 20:00:41 2012	(r239584)
+++ head/sys/kern/sched_4bsd.c	Wed Aug 22 20:01:38 2012	(r239585)
@@ -1598,6 +1598,7 @@ sched_idletd(void *dummy)
 {
 	struct pcpuidlestat *stat;
 
+	THREAD_NO_SLEEPING();
 	stat = DPCPU_PTR(idlestat);
 	for (;;) {
 		mtx_assert(&Giant, MA_NOTOWNED);

Modified: head/sys/kern/sched_ule.c
==============================================================================
--- head/sys/kern/sched_ule.c	Wed Aug 22 20:00:41 2012	(r239584)
+++ head/sys/kern/sched_ule.c	Wed Aug 22 20:01:38 2012	(r239585)
@@ -2581,6 +2581,7 @@ sched_idletd(void *dummy)
 	mtx_assert(&Giant, MA_NOTOWNED);
 	td = curthread;
 	tdq = TDQ_SELF();
+	THREAD_NO_SLEEPING();
 	for (;;) {
 #ifdef SMP
 		if (tdq_idled(tdq) == 0)

Modified: head/sys/kern/subr_turnstile.c
==============================================================================
--- head/sys/kern/subr_turnstile.c	Wed Aug 22 20:00:41 2012	(r239584)
+++ head/sys/kern/subr_turnstile.c	Wed Aug 22 20:01:38 2012	(r239585)
@@ -684,6 +684,7 @@ turnstile_wait(struct turnstile *ts, str
 	if (owner)
 		MPASS(owner->td_proc->p_magic == P_MAGIC);
 	MPASS(queue == TS_SHARED_QUEUE || queue == TS_EXCLUSIVE_QUEUE);
+	KASSERT(!TD_IS_IDLETHREAD(td), ("idle threads cannot block on locks"));
 
 	/*
 	 * If the lock does not already have a turnstile, use this thread's



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