summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2016-12-20 12:07:14 +0000
committerbluhm <bluhm@openbsd.org>2016-12-20 12:07:14 +0000
commit298d98f11ad3925cf40f1eac6912f64e2f397b43 (patch)
tree6c9b815a1cf70844e267711f5c3cb1356b2f7f8c
parentAdd the u-boot arm64 architecture number and map it to "aarch64" to (diff)
downloadwireguard-openbsd-298d98f11ad3925cf40f1eac6912f64e2f397b43.tar.xz
wireguard-openbsd-298d98f11ad3925cf40f1eac6912f64e2f397b43.zip
Put a write memory barrier into counters_enter(). This ensures
that the generation number increment is written before the function returns and anything else is written. OK patrick@ mpi@ dlg@
-rw-r--r--sys/sys/percpu.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/sys/percpu.h b/sys/sys/percpu.h
index 356b471f0b4..3b45b7e308d 100644
--- a/sys/sys/percpu.h
+++ b/sys/sys/percpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: percpu.h,v 1.4 2016/11/14 03:26:31 dlg Exp $ */
+/* $OpenBSD: percpu.h,v 1.5 2016/12/20 12:07:14 bluhm Exp $ */
/*
* Copyright (c) 2016 David Gwynne <dlg@openbsd.org>
@@ -122,6 +122,7 @@ counters_enter(struct counters_ref *ref, struct cpumem *cm)
ref->c = cpumem_enter(cm);
#ifdef MULTIPROCESSOR
ref->g = ++(*ref->c); /* make the generation number odd */
+ membar_producer();
return (ref->c + 1);
#else
return (ref->c);