summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_tc.c
diff options
context:
space:
mode:
authorcheloha <cheloha@openbsd.org>2020-07-02 23:30:38 +0000
committercheloha <cheloha@openbsd.org>2020-07-02 23:30:38 +0000
commite62bad27a59659808669209887f70d0031fae9d0 (patch)
tree566f1f7fc6648d136577eaad5811c94f24fb2c03 /sys/kern/kern_tc.c
parentAdd RAMDISK config for powerpc64. (diff)
downloadwireguard-openbsd-e62bad27a59659808669209887f70d0031fae9d0.tar.xz
wireguard-openbsd-e62bad27a59659808669209887f70d0031fae9d0.zip
timecounting: make the dummy counter interrupt- and MP-safe
The dummy counter should be deterministic with respect to interrupts and multiple threads of execution.
Diffstat (limited to 'sys/kern/kern_tc.c')
-rw-r--r--sys/kern/kern_tc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c
index 96bc4b952c8..fa9591c2683 100644
--- a/sys/kern/kern_tc.c
+++ b/sys/kern/kern_tc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_tc.c,v 1.59 2020/06/26 18:48:31 cheloha Exp $ */
+/* $OpenBSD: kern_tc.c,v 1.60 2020/07/02 23:30:38 cheloha Exp $ */
/*
* Copyright (c) 2000 Poul-Henning Kamp <phk@FreeBSD.org>
@@ -59,7 +59,7 @@ dummy_get_timecount(struct timecounter *tc)
{
static u_int now;
- return (++now);
+ return atomic_inc_int_nv(&now);
}
static struct timecounter dummy_timecounter = {