svn commit: r309148 - head/sys/kern
John Baldwin
jhb at FreeBSD.org
Fri Nov 25 18:02:45 UTC 2016
Author: jhb
Date: Fri Nov 25 18:02:43 2016
New Revision: 309148
URL: https://svnweb.freebsd.org/changeset/base/309148
Log:
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
Modified:
head/sys/kern/kern_timeout.c
head/sys/kern/subr_sleepqueue.c
Modified: head/sys/kern/kern_timeout.c
==============================================================================
--- head/sys/kern/kern_timeout.c Fri Nov 25 18:01:32 2016 (r309147)
+++ head/sys/kern/kern_timeout.c Fri Nov 25 18:02:43 2016 (r309148)
@@ -981,6 +981,8 @@ callout_when(sbintime_t sbt, sbintime_t
spinlock_exit();
#endif
#endif
+ if (cold && to_sbt == 0)
+ to_sbt = sbinuptime();
if ((flags & C_HARDCLOCK) == 0)
to_sbt += tick_sbt;
} else
Modified: head/sys/kern/subr_sleepqueue.c
==============================================================================
--- head/sys/kern/subr_sleepqueue.c Fri Nov 25 18:01:32 2016 (r309147)
+++ head/sys/kern/subr_sleepqueue.c Fri Nov 25 18:02:43 2016 (r309148)
@@ -386,7 +386,7 @@ sleepq_set_timeout_sbt(void *wchan, sbin
MPASS(TD_ON_SLEEPQ(td));
MPASS(td->td_sleepqueue == NULL);
MPASS(wchan != NULL);
- if (cold)
+ if (cold && td == &thread0)
panic("timed sleep before timers are working");
KASSERT(td->td_sleeptimo == 0, ("td %d %p td_sleeptimo %jx",
td->td_tid, td, (uintmax_t)td->td_sleeptimo));
More information about the svn-src-all
mailing list