diff options
author | Scott Soule Cheloha <cheloha@cvs.openbsd.org> | 2023-04-23 00:01:41 +0000 |
---|---|---|
committer | Scott Soule Cheloha <cheloha@cvs.openbsd.org> | 2023-04-23 00:01:41 +0000 |
commit | b7f175aedd364a5c62fb64060f52c9695ba72567 (patch) | |
tree | 75f9ebf83657b9e4d0d1e66f73e222730eac10fe /sys/kern | |
parent | 34892b3c462f47e7c465f2f1645f721672afc771 (diff) |
clockintr_advance: don't use cached uptime when called outside of dispatch
When clockintr_advance() is eventually used by outside callers, there
will be no way to know how fresh cq_uptime is. If we're not running
in the dispatch loop, we need to call nsecuptime(9) to get a high-res
uptime before advancing a clockintr.
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_clockintr.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_clockintr.c b/sys/kern/kern_clockintr.c index 7908d270151..df824f1c4ce 100644 --- a/sys/kern/kern_clockintr.c +++ b/sys/kern/kern_clockintr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_clockintr.c,v 1.19 2023/04/22 23:51:27 cheloha Exp $ */ +/* $OpenBSD: kern_clockintr.c,v 1.20 2023/04/23 00:01:40 cheloha Exp $ */ /* * Copyright (c) 2003 Dale Rahn <drahn@openbsd.org> * Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org> @@ -328,7 +328,7 @@ clockintr_advance(struct clockintr *cl, uint64_t period) mtx_enter(&cq->cq_mtx); expiration = cl->cl_expiration; - count = nsec_advance(&expiration, period, cq->cq_uptime); + count = nsec_advance(&expiration, period, nsecuptime()); if (ISSET(cl->cl_flags, CLST_PENDING)) clockintr_cancel_locked(cl); clockintr_schedule_locked(cl, expiration); |