summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorScott Soule Cheloha <cheloha@cvs.openbsd.org>2023-09-14 19:39:49 +0000
committerScott Soule Cheloha <cheloha@cvs.openbsd.org>2023-09-14 19:39:49 +0000
commit23d4dbc72605b1f0fa928f1a867d23f4130148de (patch)
treee6d8a4f068fedbe8cc4c573a15fe4545651d42ff /sys/kern
parent05d6d03a7d1d98b3c545a840954ab5e68b0e9ac7 (diff)
clockintr: replace CL_RNDSTAT with global variable statclock_is_randomized
In order to separate the statclock from the clock interrupt subsystem we need to move all statclock state out into the broader kernel. Start by replacing the CL_RNDSTAT flag with a new global variable, "statclock_is_randomized", in kern_clock.c. Update all clockintr_init() callers to set the boolean instead of passing the flag. Thread: https://marc.info/?l=openbsd-tech&m=169428749720476&w=2
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_clock.c4
-rw-r--r--sys/kern/kern_clockintr.c6
2 files changed, 6 insertions, 4 deletions
diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c
index 1c8da764a31..e23ab3e9833 100644
--- a/sys/kern/kern_clock.c
+++ b/sys/kern/kern_clock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_clock.c,v 1.116 2023/09/09 18:19:03 cheloha Exp $ */
+/* $OpenBSD: kern_clock.c,v 1.117 2023/09/14 19:39:47 cheloha Exp $ */
/* $NetBSD: kern_clock.c,v 1.34 1996/06/09 04:51:03 briggs Exp $ */
/*-
@@ -86,6 +86,8 @@ int ticks = INT_MAX - (15 * 60 * HZ);
/* Don't force early wrap around, triggers bug in inteldrm */
volatile unsigned long jiffies;
+int statclock_is_randomized; /* [I] fixed or pseudorandom period? */
+
/*
* Initialize clock frequencies and start both clocks running.
*/
diff --git a/sys/kern/kern_clockintr.c b/sys/kern/kern_clockintr.c
index aeeb7ed9158..ad92d10cddf 100644
--- a/sys/kern/kern_clockintr.c
+++ b/sys/kern/kern_clockintr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_clockintr.c,v 1.47 2023/09/10 03:08:05 cheloha Exp $ */
+/* $OpenBSD: kern_clockintr.c,v 1.48 2023/09/14 19:39:47 cheloha Exp $ */
/*
* Copyright (c) 2003 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
@@ -169,7 +169,7 @@ clockintr_cpu_init(const struct intrclock *ic)
* We can always advance the statclock. There is no reason to
* stagger a randomized statclock.
*/
- if (!ISSET(clockintr_flags, CL_RNDSTAT)) {
+ if (!statclock_is_randomized) {
if (cq->cq_statclock->cl_expiration == 0) {
clockintr_stagger(cq->cq_statclock, statclock_avg,
multiplier, MAXCPUS);
@@ -475,7 +475,7 @@ clockintr_statclock(struct clockintr *cl, void *frame, void *arg)
{
uint64_t count, i;
- if (ISSET(clockintr_flags, CL_RNDSTAT)) {
+ if (statclock_is_randomized) {
count = clockintr_advance_random(cl, statclock_min,
statclock_mask);
} else {