diff options
author | Visa Hankala <visa@cvs.openbsd.org> | 2017-04-20 13:57:31 +0000 |
---|---|---|
committer | Visa Hankala <visa@cvs.openbsd.org> | 2017-04-20 13:57:31 +0000 |
commit | da85a125dd7fd9af53b0919887129daaf4fa53bb (patch) | |
tree | a8a5d35dfd86d6f624f47c01ea1bd6c6ac4b32b6 /sys/arch/alpha | |
parent | 4718dfdd3c76a956f1a6022f2dbb3c240b27f3e2 (diff) |
Hook up mutex(9) to witness(4).
Diffstat (limited to 'sys/arch/alpha')
-rw-r--r-- | sys/arch/alpha/alpha/mutex.c | 16 | ||||
-rw-r--r-- | sys/arch/alpha/include/mutex.h | 18 |
2 files changed, 23 insertions, 11 deletions
diff --git a/sys/arch/alpha/alpha/mutex.c b/sys/arch/alpha/alpha/mutex.c index f3603e42154..ada28fad1cc 100644 --- a/sys/arch/alpha/alpha/mutex.c +++ b/sys/arch/alpha/alpha/mutex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mutex.c,v 1.16 2016/06/13 01:26:14 dlg Exp $ */ +/* $OpenBSD: mutex.c,v 1.17 2017/04/20 13:57:29 visa Exp $ */ /* * Copyright (c) 2004 Artur Grabowski <art@openbsd.org> @@ -45,14 +45,14 @@ __mtx_init(struct mutex *mtx, int wantipl) #ifdef MULTIPROCESSOR void -mtx_enter(struct mutex *mtx) +__mtx_enter(struct mutex *mtx) { - while (mtx_enter_try(mtx) == 0) + while (__mtx_enter_try(mtx) == 0) SPINLOCK_SPIN_HOOK; } int -mtx_enter_try(struct mutex *mtx) +__mtx_enter_try(struct mutex *mtx) { struct cpu_info *owner, *ci = curcpu(); int s; @@ -82,7 +82,7 @@ mtx_enter_try(struct mutex *mtx) } #else void -mtx_enter(struct mutex *mtx) +__mtx_enter(struct mutex *mtx) { struct cpu_info *ci = curcpu(); @@ -101,15 +101,15 @@ mtx_enter(struct mutex *mtx) } int -mtx_enter_try(struct mutex *mtx) +__mtx_enter_try(struct mutex *mtx) { - mtx_enter(mtx); + __mtx_enter(mtx); return (1); } #endif void -mtx_leave(struct mutex *mtx) +__mtx_leave(struct mutex *mtx) { int s; diff --git a/sys/arch/alpha/include/mutex.h b/sys/arch/alpha/include/mutex.h index c5509881c5a..a75afb2e4e8 100644 --- a/sys/arch/alpha/include/mutex.h +++ b/sys/arch/alpha/include/mutex.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mutex.h,v 1.7 2015/04/17 12:38:54 dlg Exp $ */ +/* $OpenBSD: mutex.h,v 1.8 2017/04/20 13:57:29 visa Exp $ */ /* * Copyright (c) 2004 Artur Grabowski <art@openbsd.org> @@ -28,10 +28,15 @@ #ifndef _MACHINE_MUTEX_H_ #define _MACHINE_MUTEX_H_ +#include <sys/_lock.h> + struct mutex { void *mtx_owner; int mtx_wantipl; int mtx_oldipl; +#ifdef WITNESS + struct lock_object mtx_lock_obj; +#endif }; /* @@ -48,10 +53,16 @@ struct mutex { #define __MUTEX_IPL(ipl) (ipl) #endif -#define MUTEX_INITIALIZER(ipl) { NULL, __MUTEX_IPL((ipl)), IPL_NONE } +#ifdef WITNESS +#define MUTEX_INITIALIZER_FLAGS(ipl, name, flags) \ + { NULL, __MUTEX_IPL((ipl)), IPL_NONE, MTX_LO_INITIALIZER(name, flags) } +#else +#define MUTEX_INITIALIZER_FLAGS(ipl, name, flags) \ + { NULL, __MUTEX_IPL((ipl)), IPL_NONE } +#endif void __mtx_init(struct mutex *, int); -#define mtx_init(mtx, ipl) __mtx_init((mtx), __MUTEX_IPL((ipl))) +#define _mtx_init(mtx, ipl) __mtx_init((mtx), __MUTEX_IPL((ipl))) #ifdef DIAGNOSTIC #define MUTEX_ASSERT_LOCKED(mtx) do { \ @@ -68,6 +79,7 @@ void __mtx_init(struct mutex *, int); #define MUTEX_ASSERT_UNLOCKED(mtx) do { } while (0) #endif +#define MUTEX_LOCK_OBJECT(mtx) (&(mtx)->mtx_lock_obj) #define MUTEX_OLDIPL(mtx) (mtx)->mtx_oldipl #endif /* _MACHINE_MUTEX_H_ */ |