summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorScott Soule Cheloha <cheloha@cvs.openbsd.org>2023-09-14 22:27:10 +0000
committerScott Soule Cheloha <cheloha@cvs.openbsd.org>2023-09-14 22:27:10 +0000
commita516790b36339a1d519c35aef8ed41369f8e70f9 (patch)
tree5c56392bb9319001c2266bd9db0ddb363541612d /sys/kern
parent47856badb9da1c8d27921970290837a21753ea98 (diff)
clockintr: move hz(9)-based initialization out to initclocks()
To separate the hardclock from the clock interrupt subsystem we'll need to move all related state out first. hz(9) is set when we return from cpu_initclocks(), so it's safe to move hardclock_period and roundrobin_period initialization out into initclocks(). Move hardclock_period itself out into kern_clock.c alongside the statclock variables.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_clock.c7
-rw-r--r--sys/kern/kern_clockintr.c7
2 files changed, 7 insertions, 7 deletions
diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c
index b3fbbb49da6..22c62f1f064 100644
--- a/sys/kern/kern_clock.c
+++ b/sys/kern/kern_clock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_clock.c,v 1.118 2023/09/14 20:58:51 cheloha Exp $ */
+/* $OpenBSD: kern_clock.c,v 1.119 2023/09/14 22:27:09 cheloha Exp $ */
/* $NetBSD: kern_clock.c,v 1.34 1996/06/09 04:51:03 briggs Exp $ */
/*-
@@ -87,6 +87,7 @@ int ticks = INT_MAX - (15 * 60 * HZ);
/* Don't force early wrap around, triggers bug in inteldrm */
volatile unsigned long jiffies;
+uint32_t hardclock_period; /* [I] hardclock period (ns) */
uint32_t statclock_avg; /* [I] average statclock period (ns) */
uint32_t statclock_min; /* [I] minimum statclock period (ns) */
uint32_t statclock_mask; /* [I] set of allowed offsets */
@@ -105,6 +106,10 @@ initclocks(void)
*/
cpu_initclocks();
+ KASSERT(hz > 0 && hz <= 1000000000);
+ hardclock_period = 1000000000 / hz;
+ roundrobin_period = hardclock_period * 10;
+
KASSERT(stathz >= 1 && stathz <= 1000000000);
/*
diff --git a/sys/kern/kern_clockintr.c b/sys/kern/kern_clockintr.c
index e5eaac3cca0..11d44a93676 100644
--- a/sys/kern/kern_clockintr.c
+++ b/sys/kern/kern_clockintr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_clockintr.c,v 1.51 2023/09/14 22:07:11 cheloha Exp $ */
+/* $OpenBSD: kern_clockintr.c,v 1.52 2023/09/14 22:27:09 cheloha Exp $ */
/*
* Copyright (c) 2003 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
@@ -37,7 +37,6 @@
* I Immutable after initialization.
*/
uint32_t clockintr_flags; /* [I] global state + behavior flags */
-uint32_t hardclock_period; /* [I] hardclock period (ns) */
void clockintr_hardclock(struct clockintr *, void *, void *);
void clockintr_schedule(struct clockintr *, uint64_t);
@@ -61,10 +60,6 @@ clockintr_init(uint32_t flags)
KASSERT(clockintr_flags == 0);
KASSERT(!ISSET(flags, ~CL_FLAG_MASK));
- KASSERT(hz > 0 && hz <= 1000000000);
- hardclock_period = 1000000000 / hz;
- roundrobin_period = hardclock_period * 10;
-
SET(clockintr_flags, flags | CL_INIT);
}