svn commit: r310439 - stable/11/sys/kern
John Baldwin
jhb at FreeBSD.org
Fri Dec 23 03:07:21 UTC 2016
Author: jhb
Date: Fri Dec 23 03:07:19 2016
New Revision: 310439
URL: https://svnweb.freebsd.org/changeset/base/310439
Log:
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.
Modified:
stable/11/sys/kern/kern_timeout.c
stable/11/sys/kern/subr_sleepqueue.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/kern/kern_timeout.c
==============================================================================
--- stable/11/sys/kern/kern_timeout.c Fri Dec 23 02:57:19 2016 (r310438)
+++ stable/11/sys/kern/kern_timeout.c Fri Dec 23 03:07:19 2016 (r310439)
@@ -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: stable/11/sys/kern/subr_sleepqueue.c
==============================================================================
--- stable/11/sys/kern/subr_sleepqueue.c Fri Dec 23 02:57:19 2016 (r310438)
+++ stable/11/sys/kern/subr_sleepqueue.c Fri Dec 23 03:07:19 2016 (r310439)
@@ -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