summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_timeout.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2016-12-23 03:07:19 +0000
committerjhb <jhb@FreeBSD.org>2016-12-23 03:07:19 +0000
commit8d8d7e6cef2c7820b223fe6c498703d92bb906ff (patch)
treed0921e4a033d0e1d132246109307470ba0b59074 /sys/kern/kern_timeout.c
parent36d88640d74da909ec14a3ba3e46e9d899465d54 (diff)
downloadFreeBSD-src-8d8d7e6cef2c7820b223fe6c498703d92bb906ff.zip
FreeBSD-src-8d8d7e6cef2c7820b223fe6c498703d92bb906ff.tar.gz
MFC 309148:
Permit timed sleeps for threads other than thread0 before timers are working. The callout subsystem already handles early callouts and schedules the first clock interrupt appropriately based on the currently pending callouts. The one nit to fix was that callouts scheduled via C_HARDCLOCK during early boot could fire too early once timers were enabled as the per-CPU base time is always zero until timers are initialized. The change in callout_when() handles this case by using the current uptime as the base time of the callout during bootup if the per-CPU base time is zero.
Diffstat (limited to 'sys/kern/kern_timeout.c')
-rw-r--r--sys/kern/kern_timeout.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c
index 942a78a..0fa898e 100644
--- a/sys/kern/kern_timeout.c
+++ b/sys/kern/kern_timeout.c
@@ -981,6 +981,8 @@ callout_when(sbintime_t sbt, sbintime_t precision, int flags,
spinlock_exit();
#endif
#endif
+ if (cold && to_sbt == 0)
+ to_sbt = sbinuptime();
if ((flags & C_HARDCLOCK) == 0)
to_sbt += tick_sbt;
} else
OpenPOWER on IntegriCloud