diff options
author | cheloha <cheloha@cvs.openbsd.org> | 2020-10-20 15:59:18 +0000 |
---|---|---|
committer | cheloha <cheloha@cvs.openbsd.org> | 2020-10-20 15:59:18 +0000 |
commit | cabc89bed5cb0c59a140dd68127c40c4a4605021 (patch) | |
tree | f0b23ad65e5057fb119ffd851452b36393488050 /sys/arch/sparc64 | |
parent | d0253955516b23a31fcde9265bbf2005a75e092f (diff) |
alpha, loongson, sh, sparc64: recompute tick, tick_nsec when hz(9) is reset
Normally we set hz(9) at compile-time in sys/conf/param.c to the value
of HZ. HZ is one of the fundamental compilation options(4). However,
sometimes we need to reset hz(9) at runtime.
Whenever we reset hz(9) we need to recompute tick and tick_nsec.
Otherwise a variety of "time stuff" in the kernel will not work
correctly. For example, most timeouts will expire "too slow" or "too
fast". There are a bunch of other places we use tick and tick_nsec
that will exhibit similar problems.
Test-compiled by deraadt@.
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r-- | sys/arch/sparc64/sparc64/clock.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/arch/sparc64/sparc64/clock.c b/sys/arch/sparc64/sparc64/clock.c index 451bc6848a2..9264f076bb9 100644 --- a/sys/arch/sparc64/sparc64/clock.c +++ b/sys/arch/sparc64/sparc64/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.66 2020/07/31 11:19:12 kettenis Exp $ */ +/* $OpenBSD: clock.c,v 1.67 2020/10/20 15:59:17 cheloha Exp $ */ /* $NetBSD: clock.c,v 1.41 2001/07/24 19:29:25 eeh Exp $ */ /* @@ -567,6 +567,7 @@ cpu_initclocks(void) if (intrdebug) { hz = 1; tick = 1000000 / hz; + tick_nsec = 1000000000 / hz; printf("intrdebug set: 1Hz clock\n"); } #endif @@ -575,6 +576,7 @@ cpu_initclocks(void) printf("cannot get %d Hz clock; using 100 Hz\n", hz); hz = 100; tick = 1000000 / hz; + tick_nsec = 1000000000 / hz; } /* Make sure we have a sane cpu_clockrate -- we'll need it */ |