Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Dec 2016 19:44:44 +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: r310336 - head/sys/kern
Message-ID:  <201612201944.uBKJiiMg034231@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Tue Dec 20 19:44:44 2016
New Revision: 310336
URL: https://svnweb.freebsd.org/changeset/base/310336

Log:
  Don't spin in pause() during early boot for kthreads other than thread0.
  
  pause() uses a spin loop to simulate a sleep during early boot.  However,
  we only need this for thread0 to get far enough in the boot process to
  enable timers (at which point pause() can sleep).  For other kthreads,
  sleeping in pause() is ok as the callout will be scheduled and will
  eventually fire once thread0 initializes timers.
  
  Tested by: 	Steven Kargl
  Sleuthing by:	markj
  MFC after:	1 week
  Sponsored by:	Netflix

Modified:
  head/sys/kern/kern_synch.c

Modified: head/sys/kern/kern_synch.c
==============================================================================
--- head/sys/kern/kern_synch.c	Tue Dec 20 19:30:21 2016	(r310335)
+++ head/sys/kern/kern_synch.c	Tue Dec 20 19:44:44 2016	(r310336)
@@ -321,7 +321,8 @@ pause_sbt(const char *wmesg, sbintime_t 
 	if (sbt == 0)
 		sbt = tick_sbt;
 
-	if (cold || kdb_active || SCHEDULER_STOPPED()) {
+	if ((cold && curthread == &thread0) || kdb_active ||
+	    SCHEDULER_STOPPED()) {
 		/*
 		 * We delay one second at a time to avoid overflowing the
 		 * system specific DELAY() function(s):



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