From 4c6d9147fe2ff541db95dc25133e4e496d9a3e8a Mon Sep 17 00:00:00 2001 From: mpi Date: Thu, 4 Jan 2018 11:03:48 +0000 Subject: [PATCH] Unify a bit further. Remove `mtx_lock' from i386, add volatile before `mtx_owner' where it was missing. Inputs from kettenis@, ok visa@ --- sys/arch/alpha/include/mutex.h | 4 ++-- sys/arch/hppa/include/mutex.h | 4 ++-- sys/arch/i386/i386/genassym.cf | 3 +-- sys/arch/i386/include/mutex.h | 13 ++++--------- sys/arch/m88k/include/mutex.h | 4 ++-- sys/arch/mips64/include/mutex.h | 4 ++-- 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 @@ -31,7 +31,7 @@ #include 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 @@ -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 @@ -29,15 +29,10 @@ #include -/* - * 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 @@ -31,7 +31,7 @@ #include struct mutex { - void *mtx_owner; + volatile void *mtx_owner; int mtx_wantipl; int mtx_oldipl; #ifdef WITNESS -- 2.20.1