diff options
author | Scott Soule Cheloha <cheloha@cvs.openbsd.org> | 2023-06-22 16:23:51 +0000 |
---|---|---|
committer | Scott Soule Cheloha <cheloha@cvs.openbsd.org> | 2023-06-22 16:23:51 +0000 |
commit | 6dd97923bd78a7e99e54155db64bc48dd0153d64 (patch) | |
tree | aba092ed455ab4b7d589d3def085791b70c61218 /sys | |
parent | 2972bd723e3d9d1ef4fb18283fbba655d604b946 (diff) |
Revert "clockintr_cpu_init: initialize starting offsets with clockintr_stagger()"
octeon machines do not increment the global variable "ncpus"
(init_main.c) in the same spot as other platforms, which violates the
KASSERT in clockintr_stagger(), causing a panic.
We need to bring octeon's behavior into alignment with every other
platform before proceeding with this patch.
Reported and debugged by bluhm@.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_clockintr.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/sys/kern/kern_clockintr.c b/sys/kern/kern_clockintr.c index 22a21996d00..21fad46338b 100644 --- a/sys/kern/kern_clockintr.c +++ b/sys/kern/kern_clockintr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_clockintr.c,v 1.24 2023/06/18 23:19:01 cheloha Exp $ */ +/* $OpenBSD: kern_clockintr.c,v 1.25 2023/06/22 16:23:50 cheloha Exp $ */ /* * Copyright (c) 2003 Dale Rahn <drahn@openbsd.org> * Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org> @@ -107,7 +107,7 @@ clockintr_init(u_int flags) void clockintr_cpu_init(const struct intrclock *ic) { - uint64_t multiplier = 0; + uint64_t multiplier = 0, offset; struct cpu_info *ci = curcpu(); struct clockintr_queue *cq = &ci->ci_queue; int reset_cq_intrclock = 0; @@ -170,8 +170,8 @@ clockintr_cpu_init(const struct intrclock *ic) clockintr_advance(cq->cq_hardclock, hardclock_period); } else { if (cq->cq_hardclock->cl_expiration == 0) { - clockintr_stagger(cq->cq_hardclock, hardclock_period, - multiplier, ncpus); + offset = hardclock_period / ncpus * multiplier; + cq->cq_hardclock->cl_expiration = offset; } clockintr_advance(cq->cq_hardclock, hardclock_period); } @@ -179,16 +179,12 @@ clockintr_cpu_init(const struct intrclock *ic) /* * We can always advance the statclock and schedclock. */ - if (cq->cq_statclock->cl_expiration == 0) { - clockintr_stagger(cq->cq_statclock, statclock_avg, multiplier, - ncpus); - } + offset = statclock_avg / ncpus * multiplier; + clockintr_schedule(cq->cq_statclock, offset); clockintr_advance(cq->cq_statclock, statclock_avg); if (schedhz != 0) { - if (cq->cq_schedclock->cl_expiration == 0) { - clockintr_stagger(cq->cq_schedclock, schedclock_period, - multiplier, ncpus); - } + offset = schedclock_period / ncpus * multiplier; + clockintr_schedule(cq->cq_schedclock, offset); clockintr_advance(cq->cq_schedclock, schedclock_period); } |