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
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to