| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: kern_tc.c,v 1.68 2023/07/17 13:44:24 riastradh Exp $ */ | | 1 | /* $NetBSD: kern_tc.c,v 1.69 2023/07/17 13:48:14 riastradh Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Andrew Doran. | | 8 | * by Andrew Doran. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -30,27 +30,27 @@ | | | @@ -30,27 +30,27 @@ |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | /*- | | 32 | /*- |
33 | * ---------------------------------------------------------------------------- | | 33 | * ---------------------------------------------------------------------------- |
34 | * "THE BEER-WARE LICENSE" (Revision 42): | | 34 | * "THE BEER-WARE LICENSE" (Revision 42): |
35 | * <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you | | 35 | * <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you |
36 | * can do whatever you want with this stuff. If we meet some day, and you think | | 36 | * can do whatever you want with this stuff. If we meet some day, and you think |
37 | * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp | | 37 | * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp |
38 | * --------------------------------------------------------------------------- | | 38 | * --------------------------------------------------------------------------- |
39 | */ | | 39 | */ |
40 | | | 40 | |
41 | #include <sys/cdefs.h> | | 41 | #include <sys/cdefs.h> |
42 | /* __FBSDID("$FreeBSD: src/sys/kern/kern_tc.c,v 1.166 2005/09/19 22:16:31 andre Exp $"); */ | | 42 | /* __FBSDID("$FreeBSD: src/sys/kern/kern_tc.c,v 1.166 2005/09/19 22:16:31 andre Exp $"); */ |
43 | __KERNEL_RCSID(0, "$NetBSD: kern_tc.c,v 1.68 2023/07/17 13:44:24 riastradh Exp $"); | | 43 | __KERNEL_RCSID(0, "$NetBSD: kern_tc.c,v 1.69 2023/07/17 13:48:14 riastradh Exp $"); |
44 | | | 44 | |
45 | #ifdef _KERNEL_OPT | | 45 | #ifdef _KERNEL_OPT |
46 | #include "opt_ntp.h" | | 46 | #include "opt_ntp.h" |
47 | #endif | | 47 | #endif |
48 | | | 48 | |
49 | #include <sys/param.h> | | 49 | #include <sys/param.h> |
50 | | | 50 | |
51 | #include <sys/atomic.h> | | 51 | #include <sys/atomic.h> |
52 | #include <sys/evcnt.h> | | 52 | #include <sys/evcnt.h> |
53 | #include <sys/ipi.h> | | 53 | #include <sys/ipi.h> |
54 | #include <sys/kauth.h> | | 54 | #include <sys/kauth.h> |
55 | #include <sys/kernel.h> | | 55 | #include <sys/kernel.h> |
56 | #include <sys/lock.h> | | 56 | #include <sys/lock.h> |
| @@ -125,28 +125,28 @@ static struct timehands th1 = { .th_next | | | @@ -125,28 +125,28 @@ static struct timehands th1 = { .th_next |
125 | static struct timehands th0 = { | | 125 | static struct timehands th0 = { |
126 | .th_counter = &dummy_timecounter, | | 126 | .th_counter = &dummy_timecounter, |
127 | .th_scale = (uint64_t)-1 / 1000000, | | 127 | .th_scale = (uint64_t)-1 / 1000000, |
128 | .th_offset = { .sec = 1, .frac = 0 }, | | 128 | .th_offset = { .sec = 1, .frac = 0 }, |
129 | .th_generation = 1, | | 129 | .th_generation = 1, |
130 | .th_next = &th1, | | 130 | .th_next = &th1, |
131 | }; | | 131 | }; |
132 | | | 132 | |
133 | static struct timehands *volatile timehands = &th0; | | 133 | static struct timehands *volatile timehands = &th0; |
134 | struct timecounter *timecounter = &dummy_timecounter; | | 134 | struct timecounter *timecounter = &dummy_timecounter; |
135 | static struct timecounter *timecounters = &dummy_timecounter; | | 135 | static struct timecounter *timecounters = &dummy_timecounter; |
136 | | | 136 | |
137 | #ifdef __HAVE_ATOMIC64_LOADSTORE | | 137 | #ifdef __HAVE_ATOMIC64_LOADSTORE |
138 | static volatile time_t time__second __cacheline_aligned = 1; | | 138 | volatile time_t time__second __cacheline_aligned = 1; |
139 | static volatile time_t time__uptime __cacheline_aligned = 1; | | 139 | volatile time_t time__uptime __cacheline_aligned = 1; |
140 | #else | | 140 | #else |
141 | static volatile struct { | | 141 | static volatile struct { |
142 | uint32_t lo, hi; | | 142 | uint32_t lo, hi; |
143 | } time__uptime32 __cacheline_aligned = { | | 143 | } time__uptime32 __cacheline_aligned = { |
144 | .lo = 1, | | 144 | .lo = 1, |
145 | }, time__second32 __cacheline_aligned = { | | 145 | }, time__second32 __cacheline_aligned = { |
146 | .lo = 1, | | 146 | .lo = 1, |
147 | }; | | 147 | }; |
148 | #endif | | 148 | #endif |
149 | | | 149 | |
150 | static struct bintime timebasebin; | | 150 | static struct bintime timebasebin; |
151 | | | 151 | |
152 | static int timestepwarnings; | | 152 | static int timestepwarnings; |