diff options
author | Alexander Yurchenko <grange@cvs.openbsd.org> | 2004-11-10 11:00:01 +0000 |
---|---|---|
committer | Alexander Yurchenko <grange@cvs.openbsd.org> | 2004-11-10 11:00:01 +0000 |
commit | eec4bab554d8ea2107745babed8eea811f6b5744 (patch) | |
tree | 359c41383a64d7c47cbf3f581c696f319d925a6e /sys/kern | |
parent | 9a102a9bd54e75924c164c793a14c0c6aa80f4de (diff) |
Diff from art@:
Update ticks in timeout_hardclock_update to avoid errors in hardclock (this
is the third time we mess up here). ticks is only used for timeouts anyway.
At the same protect updating ticks with timeout_mutex and be slightly
more paranoid in timeout_hardclock_update.
ok tdeval@ miod@
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_clock.c | 3 | ||||
-rw-r--r-- | sys/kern/kern_timeout.c | 11 |
2 files changed, 10 insertions, 4 deletions
diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c index c7873d167cf..d5bc91a5918 100644 --- a/sys/kern/kern_clock.c +++ b/sys/kern/kern_clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_clock.c,v 1.51 2004/09/15 17:48:52 grange Exp $ */ +/* $OpenBSD: kern_clock.c,v 1.52 2004/11/10 11:00:00 grange Exp $ */ /* $NetBSD: kern_clock.c,v 1.34 1996/06/09 04:51:03 briggs Exp $ */ /*- @@ -271,7 +271,6 @@ hardclock(struct clockframe *frame) * if we are still adjusting the time (see adjtime()), * ``tickdelta'' may also be added in. */ - ticks++; delta = tick; diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c index 921f4be9cff..da14eadd5cf 100644 --- a/sys/kern/kern_timeout.c +++ b/sys/kern/kern_timeout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_timeout.c,v 1.19 2004/07/20 20:20:52 art Exp $ */ +/* $OpenBSD: kern_timeout.c,v 1.20 2004/11/10 11:00:00 grange Exp $ */ /* * Copyright (c) 2001 Thomas Nordin <nordin@openbsd.org> * Copyright (c) 2000-2001 Artur Grabowski <art@openbsd.org> @@ -200,7 +200,12 @@ timeout_del(struct timeout *to) int timeout_hardclock_update(void) { + int ret; + mtx_enter(&timeout_mutex); + + ticks++; + MOVEBUCKET(0, ticks); if (MASKWHEEL(0, ticks) == 0) { MOVEBUCKET(1, ticks); @@ -210,8 +215,10 @@ timeout_hardclock_update(void) MOVEBUCKET(3, ticks); } } + ret = !CIRCQ_EMPTY(&timeout_todo); mtx_leave(&timeout_mutex); - return (!CIRCQ_EMPTY(&timeout_todo)); + + return (ret); } void |