summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorScott Soule Cheloha <cheloha@cvs.openbsd.org>2023-04-21 15:33:01 +0000
committerScott Soule Cheloha <cheloha@cvs.openbsd.org>2023-04-21 15:33:01 +0000
commit8d21369f7f67c670d520b76334965296fddc6789 (patch)
treeb2828da966612de960f5584ae7c2d38d49eb5ef2 /sys/kern
parent8760e7246e9cb733bd71d46b6c87fbb573d7bf2d (diff)
clockintr_cpu_init: avoid CQ_INIT flag when scheduling cq_hardclock
The meaning of the CQ_INIT flag is about to change. Soon, we won't be able to use it to decide whether a given clockintr_cpu_init() call is the first on a given CPU. Instead, use the value of cl_expiration. If it's zero, we know this is the first clockintr_cpu_init() call on this CPU.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_clockintr.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/sys/kern/kern_clockintr.c b/sys/kern/kern_clockintr.c
index af6198cb373..bc4e4686877 100644
--- a/sys/kern/kern_clockintr.c
+++ b/sys/kern/kern_clockintr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_clockintr.c,v 1.15 2023/04/21 03:03:50 cheloha Exp $ */
+/* $OpenBSD: kern_clockintr.c,v 1.16 2023/04/21 15:33:00 cheloha Exp $ */
/*
* Copyright (c) 2003 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
@@ -169,10 +169,18 @@ clockintr_cpu_init(const struct intrclock *ic)
* the global tick value is advanced during inittodr(9) on our
* behalf.
*/
- offset = hardclock_period / ncpus * multiplier;
- clockintr_schedule(cq->cq_hardclock, offset);
- if (!CPU_IS_PRIMARY(ci) || ISSET(cq->cq_flags, CQ_INIT))
+ if (CPU_IS_PRIMARY(ci)) {
+ if (cq->cq_hardclock->cl_expiration == 0)
+ clockintr_schedule(cq->cq_hardclock, 0);
+ else
+ clockintr_advance(cq->cq_hardclock, hardclock_period);
+ } else {
+ if (cq->cq_hardclock->cl_expiration == 0) {
+ offset = hardclock_period / ncpus * multiplier;
+ cq->cq_hardclock->cl_expiration = offset;
+ }
clockintr_advance(cq->cq_hardclock, hardclock_period);
+ }
/*
* We can always advance the statclock and schedclock.