kernel - Fix stall after mountroot w/ SMP & ncpus == 1
authorMatthew Dillon <dillon@apollo.backplane.com>
Mon, 31 Jan 2011 21:08:26 +0000 (13:08 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Mon, 31 Jan 2011 21:08:26 +0000 (13:08 -0800)
* Fix a degenerate case for SMP builds when ncpus == 1.  This effects
  both the vkernel and the normal kernel (when a SMP kernel is booted
  on a non-SMP box which has a LAPIC).

  The init process was not bring scheduled properly.

sys/kern/usched_bsd4.c

index 29dd464..1f9fe99 100644 (file)
@@ -553,8 +553,13 @@ bsd4_setrunqueue(struct lwp *lp)
 found:
        if (gd == mycpu) {
                spin_unlock(&bsd4_spin);
-               if ((dd->upri & ~PPQMASK) > (lp->lwp_priority & ~PPQMASK))
-                       need_user_resched();
+               if ((dd->upri & ~PPQMASK) > (lp->lwp_priority & ~PPQMASK)) {
+                       if (dd->uschedcp == NULL) {
+                               lwkt_schedule(&dd->helper_thread);
+                       } else {
+                               need_user_resched();
+                       }
+               }
        } else {
                atomic_clear_cpumask(&bsd4_rdyprocmask, CPUMASK(cpuid));
                spin_unlock(&bsd4_spin);