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
This commit is contained in:
parent
26aa2dc584
commit
9f3aabb9eb
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=309148
@ -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
|
||||
|
@ -386,7 +386,7 @@ sleepq_set_timeout_sbt(void *wchan, sbintime_t sbt, sbintime_t pr,
|
||||
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));
|
||||
|
Loading…
Reference in New Issue
Block a user