Permit timed sleeps for threads other than thread0 before timers are working.
authorjhb <jhb@FreeBSD.org>
Fri, 25 Nov 2016 18:02:43 +0000 (18:02 +0000)
committerjhb <jhb@FreeBSD.org>
Fri, 25 Nov 2016 18:02:43 +0000 (18:02 +0000)
commitf91c1f17917bbaf984b6207474df268e4faf9b92
tree06028a058b2e0a37171f4cbe0605d1155dd46ce3
parent29bc5ed5acd7562fa004980f538dc80937fa0042
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.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: Netflix
sys/kern/kern_timeout.c
sys/kern/subr_sleepqueue.c