summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2018-01-04 11:03:48 +0000
committermpi <mpi@openbsd.org>2018-01-04 11:03:48 +0000
commit4c6d9147fe2ff541db95dc25133e4e496d9a3e8a (patch)
tree6a9683139f5b07d7d51dcbb32eaa125bec81111f
parentBack out tx mitigation again because it breaks suspend and resume at (diff)
downloadwireguard-openbsd-4c6d9147fe2ff541db95dc25133e4e496d9a3e8a.tar.xz
wireguard-openbsd-4c6d9147fe2ff541db95dc25133e4e496d9a3e8a.zip
Unify <machine/mutex.h> a bit further.
Remove `mtx_lock' from i386, add volatile before `mtx_owner' where it was missing. Inputs from kettenis@, ok visa@
-rw-r--r--sys/arch/alpha/include/mutex.h4
-rw-r--r--sys/arch/hppa/include/mutex.h4
-rw-r--r--sys/arch/i386/i386/genassym.cf3
-rw-r--r--sys/arch/i386/include/mutex.h13
-rw-r--r--sys/arch/m88k/include/mutex.h4
-rw-r--r--sys/arch/mips64/include/mutex.h4
6 files changed, 13 insertions, 19 deletions
diff --git a/sys/arch/alpha/include/mutex.h b/sys/arch/alpha/include/mutex.h
index a75afb2e4e8..720a30baba2 100644
--- a/sys/arch/alpha/include/mutex.h
+++ b/sys/arch/alpha/include/mutex.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mutex.h,v 1.8 2017/04/20 13:57:29 visa Exp $ */
+/* $OpenBSD: mutex.h,v 1.9 2018/01/04 11:03:48 mpi Exp $ */
/*
* Copyright (c) 2004 Artur Grabowski <art@openbsd.org>
@@ -31,7 +31,7 @@
#include <sys/_lock.h>
struct mutex {
- void *mtx_owner;
+ volatile void *mtx_owner;
int mtx_wantipl;
int mtx_oldipl;
#ifdef WITNESS
diff --git a/sys/arch/hppa/include/mutex.h b/sys/arch/hppa/include/mutex.h
index 48eacedd33e..3b16361fb1e 100644
--- a/sys/arch/hppa/include/mutex.h
+++ b/sys/arch/hppa/include/mutex.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mutex.h,v 1.7 2017/04/20 13:57:29 visa Exp $ */
+/* $OpenBSD: mutex.h,v 1.8 2018/01/04 11:03:48 mpi Exp $ */
/*
* Copyright (c) 2004 Artur Grabowski <art@openbsd.org>
@@ -39,7 +39,7 @@ struct mutex {
#endif
int mtx_wantipl;
int mtx_oldipl;
- void *mtx_owner;
+ volatile void *mtx_owner;
#ifdef WITNESS
struct lock_object mtx_lock_obj;
#endif
diff --git a/sys/arch/i386/i386/genassym.cf b/sys/arch/i386/i386/genassym.cf
index 56857faa88e..f8b4a85a57c 100644
--- a/sys/arch/i386/i386/genassym.cf
+++ b/sys/arch/i386/i386/genassym.cf
@@ -1,4 +1,4 @@
-# $OpenBSD: genassym.cf,v 1.39 2016/03/15 03:17:51 guenther Exp $
+# $OpenBSD: genassym.cf,v 1.40 2018/01/04 11:03:48 mpi Exp $
#
# Copyright (c) 1982, 1990 The Regents of the University of California.
# All rights reserved.
@@ -136,7 +136,6 @@ member ih_next
endif
struct mutex
-member mtx_lock
member mtx_wantipl
member mtx_oldipl
member mtx_owner
diff --git a/sys/arch/i386/include/mutex.h b/sys/arch/i386/include/mutex.h
index 72d9bbf1638..0f2d542de04 100644
--- a/sys/arch/i386/include/mutex.h
+++ b/sys/arch/i386/include/mutex.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mutex.h,v 1.9 2017/04/20 13:57:29 visa Exp $ */
+/* $OpenBSD: mutex.h,v 1.10 2018/01/04 11:03:48 mpi Exp $ */
/*
* Copyright (c) 2004 Artur Grabowski <art@openbsd.org>
@@ -29,15 +29,10 @@
#include <sys/_lock.h>
-/*
- * XXX - we don't really need the mtx_lock field, we can use mtx_oldipl
- * as the lock to save some space.
- */
struct mutex {
- volatile int mtx_lock;
int mtx_wantipl;
int mtx_oldipl;
- void *mtx_owner;
+ volatile void *mtx_owner;
#ifdef WITNESS
struct lock_object mtx_lock_obj;
#endif
@@ -59,10 +54,10 @@ struct mutex {
#ifdef WITNESS
#define MUTEX_INITIALIZER_FLAGS(ipl, name, flags) \
- { 0, __MUTEX_IPL(ipl), 0, NULL, MTX_LO_INITIALIZER(name, flags) }
+ { __MUTEX_IPL((ipl)), 0, NULL, MTX_LO_INITIALIZER(name, flags) }
#else
#define MUTEX_INITIALIZER_FLAGS(ipl, name, flags) \
- { 0, __MUTEX_IPL(ipl), 0, NULL }
+ { __MUTEX_IPL((ipl)), 0, NULL }
#endif
void __mtx_init(struct mutex *, int);
diff --git a/sys/arch/m88k/include/mutex.h b/sys/arch/m88k/include/mutex.h
index dba995bf6d6..446a2d92661 100644
--- a/sys/arch/m88k/include/mutex.h
+++ b/sys/arch/m88k/include/mutex.h
@@ -1,6 +1,6 @@
#ifndef _M88K_MUTEX_H_
#define _M88K_MUTEX_H_
-/* $OpenBSD: mutex.h,v 1.5 2017/04/20 13:57:29 visa Exp $ */
+/* $OpenBSD: mutex.h,v 1.6 2018/01/04 11:03:48 mpi Exp $ */
/*
* Copyright (c) 2005, Miodrag Vallat.
@@ -33,7 +33,7 @@ struct mutex {
volatile int mtx_lock; /* mutex.S relies upon this field being first */
int mtx_wantipl;
int mtx_oldipl;
- void *mtx_owner;
+ volatile void *mtx_owner;
#ifdef WITNESS
struct lock_object mtx_lock_obj;
#endif
diff --git a/sys/arch/mips64/include/mutex.h b/sys/arch/mips64/include/mutex.h
index e8cd240b8ee..8ba5052d530 100644
--- a/sys/arch/mips64/include/mutex.h
+++ b/sys/arch/mips64/include/mutex.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mutex.h,v 1.2 2017/04/20 13:57:30 visa Exp $ */
+/* $OpenBSD: mutex.h,v 1.3 2018/01/04 11:03:48 mpi Exp $ */
/*
* Copyright (c) 2004 Artur Grabowski <art@openbsd.org>
@@ -31,7 +31,7 @@
#include <sys/_lock.h>
struct mutex {
- void *mtx_owner;
+ volatile void *mtx_owner;
int mtx_wantipl;
int mtx_oldipl;
#ifdef WITNESS