From 99bc7e4123d8cc0349198f4257dc5a896e4946b5 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Tue, 20 Dec 2016 19:44:44 +0000 Subject: [PATCH] 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 --- sys/kern/kern_synch.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index fc02cb39044..b1b497928c8 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -321,7 +321,8 @@ pause_sbt(const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags) 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):