Permit timed sleeps before timers are working.
The callout subsystem already handles early callouts and schedules
the first clock interrupt appropriately based on the currently pending
callouts.
Differential D8618
Permit timed sleeps before timers are working. jhb on Nov 23 2016, 12:10 AM. Authored by Tags None Referenced Files
Subscribers None
Details
Permit timed sleeps before timers are working. The callout subsystem already handles early callouts and schedules
CALLOUT: uptime at test start: 4294988770 If you examine the values in hex you get 0x1000053e2 for the test start and 0x100066c2a when the timers start. The first callout fires about a quarter of a second later at 0x142ed546b. The remaining callouts are all about a second early: 0x204d59de1, 0x4062bf29c, and 0xa00287bbf. I could "fix" this by patching callout_when() to use sbinuptime() as the time base instead of DPCPU_GET() before timer interrupts are initialized, or we could just let it be? Also, I had originally suggested to still panic in the sleepq code for thread0, so if that is desired I can restrict the panic that this removes to only be for thread0. Finally, callout_reset() that is too early should panic due to cc_inited == 0 check in callout_reset_sbt_on(), so need to add a new check for that.
Diff Detail
Event TimelineComment Actions My current feel is that it is fine to leave the 1 sec inaccuracy as is, until proven harmful. As I understand the current state, early callouts are guaranteed to fire not earlier than timer starts, which make the attempt to handle this rather ineffective. OTOH, I do think that panic for thread0 sleeping too early is the good thing to have, since this is the feature that would allow to detect deadlocks with non-functional callouts required to make the progress. Comment Actions
Comment Actions Latest output (now in hex since that is simpler to work with): CALLOUT: uptime at test start: 1000064a9 CALLOUT: time when starting: 10007570c CALLOUT: 1 second fired at 236c02328 CALLOUT: 2 second fired at 32214bee0 CALLOUT: 4 second fired at 500287315 CALLOUT: 10 second fired at b162dd900
|