initclocks: don't reinitialize ticks, jiffies at runtime
authorcheloha <cheloha@openbsd.org>
Fri, 3 Mar 2023 20:16:44 +0000 (20:16 +0000)
committercheloha <cheloha@openbsd.org>
Fri, 3 Mar 2023 20:16:44 +0000 (20:16 +0000)
commitd8920042b55e882518faeefa665ee7f67ce9c555
tree7ae73bf71045c0d470138a9f285ad232196737a1
parent693dc5e1c009c5ddba5b7e66566029d2e38cec79
initclocks: don't reinitialize ticks, jiffies at runtime

Various drivers use ticks/jiffies before initclocks().  It isn't
generally safe to reinitialize them at runtime.  Hoist the conditional
definition of HZ from param.c into sys/kernel.h so we can see it from
kern_clock.c and statically initialize ticks/jiffies to the desired
offset.

With this change, timeouts scheduled before initclocks() do not all
fire immediately during the first softclock().

With input from kettenis@.

Link: https://marc.info/?l=openbsd-tech&m=167753870803378&w=2
sys/conf/param.c
sys/kern/kern_clock.c
sys/sys/kernel.h