From: cheloha Date: Mon, 3 Apr 2023 17:40:51 +0000 (+0000) Subject: clockintr: clockintr_cpu_init(): isolate struct clockintr_queue setup X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=bdd1445da1dd9c39177516ec9c8711bd079a89a1;p=openbsd clockintr: clockintr_cpu_init(): isolate struct clockintr_queue setup We will always need to initialize the clockintr_queue struct. However, the hardclock, schedclock, and statclock will not always be a part of that struct. Move the clockintr_establish() calls in clockintr_cpu_init() away from the other initialization steps to make the dependency relationship more obvious. We need to intialize a struct clockintr_queue before we can establish clock interrupts. --- diff --git a/sys/kern/kern_clockintr.c b/sys/kern/kern_clockintr.c index c937d63c4e7..45f396e9b81 100644 --- a/sys/kern/kern_clockintr.c +++ b/sys/kern/kern_clockintr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_clockintr.c,v 1.6 2023/04/03 00:20:24 cheloha Exp $ */ +/* $OpenBSD: kern_clockintr.c,v 1.7 2023/04/03 17:40:51 cheloha Exp $ */ /* * Copyright (c) 2003 Dale Rahn * Copyright (c) 2020 Mark Kettenis @@ -115,6 +115,13 @@ clockintr_cpu_init(const struct intrclock *ic) mtx_init(&cq->cq_mtx, IPL_CLOCK); TAILQ_INIT(&cq->cq_est); TAILQ_INIT(&cq->cq_pend); + if (ic != NULL) { + cq->cq_intrclock = *ic; + SET(cq->cq_flags, CL_CPU_INTRCLOCK); + } + cq->cq_gen = 1; + + /* TODO: Remove these from struct clockintr_queue. */ cq->cq_hardclock = clockintr_establish(cq, clockintr_hardclock); if (cq->cq_hardclock == NULL) panic("%s: failed to establish hardclock", __func__); @@ -129,11 +136,6 @@ clockintr_cpu_init(const struct intrclock *ic) __func__); } } - if (ic != NULL) { - cq->cq_intrclock = *ic; - SET(cq->cq_flags, CL_CPU_INTRCLOCK); - } - cq->cq_gen = 1; } /*