-/* $OpenBSD: mutex.h,v 1.9 2018/01/13 15:18:11 mpi Exp $ */
+/* $OpenBSD: mutex.h,v 1.10 2024/05/16 09:30:03 kettenis Exp $ */
/*
* Copyright (c) 2004 Artur Grabowski <art@openbsd.org>
#endif
};
-/*
- * To prevent lock ordering problems with the kernel lock, we need to
- * make sure we block all interrupts that can grab the kernel lock.
- * The simplest way to achieve this is to make sure mutexes always
- * raise the interrupt priority level to the highest level that has
- * interrupts that grab the kernel lock.
- */
#ifdef MULTIPROCESSOR
-#define __MUTEX_IPL(ipl) \
- (((ipl) > IPL_NONE && (ipl) < IPL_MPFLOOR) ? IPL_MPFLOOR : (ipl))
#ifdef WITNESS
#define MUTEX_INITIALIZER_FLAGS(ipl, name, flags) \
{ MUTEX_UNLOCKED, __MUTEX_IPL((ipl)), 0, NULL, \
{ MUTEX_UNLOCKED, __MUTEX_IPL((ipl)), 0, NULL }
#endif /* WITNESS */
#else /* MULTIPROCESSOR */
-#define __MUTEX_IPL(ipl) (ipl)
#define MUTEX_INITIALIZER_FLAGS(ipl, name, flags) \
{ __MUTEX_IPL((ipl)), 0, NULL }
#endif /* MULTIPROCESSOR */
-#ifndef _M88K_MUTEX_H_
-#define _M88K_MUTEX_H_
-/* $OpenBSD: mutex.h,v 1.8 2020/05/26 11:55:10 aoyama Exp $ */
+/* $OpenBSD: mutex.h,v 1.9 2024/05/16 09:30:03 kettenis Exp $ */
/*
* Copyright (c) 2005, Miodrag Vallat.
* POSSIBILITY OF SUCH DAMAGE.
*/
+#ifndef _M88K_MUTEX_H_
+#define _M88K_MUTEX_H_
+
#include <sys/_lock.h>
struct mutex {
#endif
};
-/*
- * To prevent lock ordering problems with the kernel lock, we need to
- * make sure we block all interrupts that can grab the kernel lock.
- * The simplest way to achieve this is to make sure mutexes always
- * raise the interrupt priority level to the highest level that has
- * interrupts that grab the kernel lock.
- */
-#ifdef MULTIPROCESSOR
-#define __MUTEX_IPL(ipl) \
- (((ipl) > IPL_NONE && (ipl) < IPL_MPFLOOR) ? IPL_MPFLOOR : (ipl))
-#else
-#define __MUTEX_IPL(ipl) (ipl)
-#endif
-
#ifdef WITNESS
#define MUTEX_INITIALIZER_FLAGS(ipl, name, flags) \
{ 0, __MUTEX_IPL((ipl)), IPL_NONE, NULL, \
-/* $OpenBSD: mutex.h,v 1.21 2024/03/26 18:18:30 bluhm Exp $ */
+/* $OpenBSD: mutex.h,v 1.22 2024/05/16 09:30:03 kettenis Exp $ */
/*
* Copyright (c) 2004 Artur Grabowski <art@openbsd.org>
* "mtx_enter(foo); mtx_enter(bar); mtx_leave(foo); mtx_leave(bar);"
*/
+/*
+ * To prevent lock ordering problems with the kernel lock, we need to
+ * make sure we block all interrupts that can grab the kernel lock.
+ * The simplest way to achieve this is to make sure mutexes always
+ * raise the interrupt priority level to the highest level that has
+ * interrupts that grab the kernel lock.
+ */
+#ifdef MULTIPROCESSOR
+#define __MUTEX_IPL(ipl) \
+ (((ipl) < IPL_MPFLOOR) ? IPL_MPFLOOR : (ipl))
+#else
+#define __MUTEX_IPL(ipl) (ipl)
+#endif
+
#include <machine/mutex.h>
#ifdef __USE_MI_MUTEX
#endif
};
-/*
- * To prevent lock ordering problems with the kernel lock, we need to
- * make sure we block all interrupts that can grab the kernel lock.
- * The simplest way to achieve this is to make sure mutexes always
- * raise the interrupt priority level to the highest level that has
- * interrupts that grab the kernel lock.
- */
-#ifdef MULTIPROCESSOR
-#define __MUTEX_IPL(ipl) \
- (((ipl) > IPL_NONE && (ipl) < IPL_MPFLOOR) ? IPL_MPFLOOR : (ipl))
-#else
-#define __MUTEX_IPL(ipl) (ipl)
-#endif
-
#ifdef WITNESS
#define MUTEX_INITIALIZER_FLAGS(ipl, name, flags) \
{ NULL, __MUTEX_IPL((ipl)), IPL_NONE, MTX_LO_INITIALIZER(name, flags) }