summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorScott Soule Cheloha <cheloha@cvs.openbsd.org>2023-04-21 16:35:21 +0000
committerScott Soule Cheloha <cheloha@cvs.openbsd.org>2023-04-21 16:35:21 +0000
commitf4914fc43fa6e7340b3ba983c698f3efa83b7962 (patch)
tree748b8338a169a1c7cbc68a9cd4edaa04f40617b1 /sys
parent23ff3e23aab023d3adb584daac4e8ccfa935919b (diff)
clockintr: prepare to hoist clockqueue_init() out of clockintr_cpu_init()
Reorganize the initialization block in clockintr_cpu_init() so that it doesn't break when clockqueue_init() is called separately: - If CQ_INTRCLOCK is not set, this is the first clockintr_cpu_init() call and we can install the intrclock given as argument. - If any of the internal clock interrupt handles are NULL, this is the first clockintr_cpu_init() call and we need to establish them.
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_clockintr.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/sys/kern/kern_clockintr.c b/sys/kern/kern_clockintr.c
index 8f065f54cdd..b95346f123c 100644
--- a/sys/kern/kern_clockintr.c
+++ b/sys/kern/kern_clockintr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_clockintr.c,v 1.17 2023/04/21 15:49:37 cheloha Exp $ */
+/* $OpenBSD: kern_clockintr.c,v 1.18 2023/04/21 16:35:20 cheloha Exp $ */
/*
* Copyright (c) 2003 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
@@ -114,28 +114,28 @@ clockintr_cpu_init(const struct intrclock *ic)
KASSERT(ISSET(clockintr_flags, CL_INIT));
- if (!ISSET(cq->cq_flags, CQ_INIT)) {
- clockqueue_init(cq);
- if (ic != NULL) {
- cq->cq_intrclock = *ic;
- SET(cq->cq_flags, CQ_INTRCLOCK);
- }
+ clockqueue_init(cq);
+ if (ic != NULL && !ISSET(cq->cq_flags, CQ_INTRCLOCK)) {
+ cq->cq_intrclock = *ic;
+ SET(cq->cq_flags, CQ_INTRCLOCK);
+ }
- /* TODO: Remove these from struct clockintr_queue. */
+ /* TODO: Remove these from struct clockintr_queue. */
+ if (cq->cq_hardclock == NULL) {
cq->cq_hardclock = clockintr_establish(cq, clockintr_hardclock);
if (cq->cq_hardclock == NULL)
panic("%s: failed to establish hardclock", __func__);
+ }
+ if (cq->cq_statclock == NULL) {
cq->cq_statclock = clockintr_establish(cq, clockintr_statclock);
if (cq->cq_statclock == NULL)
panic("%s: failed to establish statclock", __func__);
- if (schedhz != 0) {
- cq->cq_schedclock = clockintr_establish(cq,
- clockintr_schedclock);
- if (cq->cq_schedclock == NULL) {
- panic("%s: failed to establish schedclock",
- __func__);
- }
- }
+ }
+ if (schedhz != 0 && cq->cq_schedclock == NULL) {
+ cq->cq_schedclock = clockintr_establish(cq,
+ clockintr_schedclock);
+ if (cq->cq_schedclock == NULL)
+ panic("%s: failed to establish schedclock", __func__);
}
/*