Page MenuHomeFreeBSD

Rework handling of thread sleeps before timers are working.
ClosedPublic

Authored by jhb on Mar 24 2016, 12:53 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Aug 16, 6:26 PM
Unknown Object (File)
Thu, Aug 15, 5:32 PM
Unknown Object (File)
Mon, Aug 12, 8:14 PM
Unknown Object (File)
Mon, Jul 29, 10:53 PM
Unknown Object (File)
Mon, Jul 29, 9:45 AM
Unknown Object (File)
Mon, Jul 22, 5:01 AM
Unknown Object (File)
Jul 18 2024, 7:27 PM
Unknown Object (File)
Jul 15 2024, 6:04 AM
Subscribers

Details

Summary

Rework handling of thread sleeps before timers are working.

Previously, calls to *sleep() and cv_*wait*() immediately returned during
early boot. Instead, permit threads that request a sleep without a
timeout to sleep as wakeup() works during early boot. Sleeps with
timeouts are harder to emulate without working timers, so just punt and
panic explicitly if any thread tries to use those before timers are
working. Any threads that depend on timeouts should either wait until
SI_SUB_KICK_SCHEDULER to start or they should use DELAY() until timers
are available.

Until APs are started earlier this should be a no-op as other kthreads
shouldn't get a chance to start running until after timers are working
regardless of when they were created.

Test Plan
  • boot kernels both with just this change but also with the rest of the early AP startup patches with EARLY_AP_STARTUP applied

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jhb retitled this revision from to Rework handling of thread sleeps before timers are working..
jhb updated this object.
jhb edited the test plan for this revision. (Show Details)
jhb added a reviewer: kib.

What about lockmgr, it also uses sleepq_timedwait() ?

Might be, the cold panic should be moved to sleepq_timedwait() ?

In D5724#122295, @kib wrote:

What about lockmgr, it also uses sleepq_timedwait() ?

Might be, the cold panic should be moved to sleepq_timedwait() ?

Mmmm, yes.

jhb edited edge metadata.
  • Move the panic for timed sleeps into sleepq_set_timeout_sbt().
kib edited edge metadata.
This revision is now accepted and ready to land.Mar 31 2016, 5:37 PM
This revision was automatically updated to reflect the committed changes.