summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorVisa Hankala <visa@cvs.openbsd.org>2019-04-23 13:35:13 +0000
committerVisa Hankala <visa@cvs.openbsd.org>2019-04-23 13:35:13 +0000
commitdb15e483f2f5e75ad8bbfdaf5ee6bff366cddd10 (patch)
treeabd435dbfd3f96ef09966365d12dab45a8073635 /sys/arch
parentad2ed30d0674bbe8c3cf6f1b4f476b382b9e35cb (diff)
Remove file name and line number output from witness(4)
Reduce code clutter by removing the file name and line number output from witness(4). Typically it is easy enough to locate offending locks using the stack traces that are shown in lock order conflict reports. Tricky cases can be tracked using sysctl kern.witness.locktrace=1 . This patch additionally removes the witness(4) wrapper for mutexes. Now each mutex implementation has to invoke the WITNESS_*() macros in order to utilize the checker. Discussed with and OK dlg@, OK mpi@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/hppa/hppa/lock_machdep.c24
-rw-r--r--sys/arch/hppa/hppa/mutex.c18
-rw-r--r--sys/arch/hppa/include/mplock.h22
-rw-r--r--sys/arch/m88k/m88k/mutex.S8
-rw-r--r--sys/arch/sparc64/sparc64/mutex.S8
5 files changed, 34 insertions, 46 deletions
diff --git a/sys/arch/hppa/hppa/lock_machdep.c b/sys/arch/hppa/hppa/lock_machdep.c
index aeccffad61c..44c9dda7fb4 100644
--- a/sys/arch/hppa/hppa/lock_machdep.c
+++ b/sys/arch/hppa/hppa/lock_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lock_machdep.c,v 1.13 2017/12/04 09:51:03 mpi Exp $ */
+/* $OpenBSD: lock_machdep.c,v 1.14 2019/04/23 13:35:12 visa Exp $ */
/*
* Copyright (c) 2007 Artur Grabowski <art@openbsd.org>
@@ -95,14 +95,14 @@ __mp_lock_spin(struct __mp_lock *mpl)
}
void
-___mp_lock(struct __mp_lock *mpl LOCK_FL_VARS)
+__mp_lock(struct __mp_lock *mpl)
{
int s;
#ifdef WITNESS
if (!__mp_lock_held(mpl, curcpu()))
WITNESS_CHECKORDER(&mpl->mpl_lock_obj,
- LOP_EXCLUSIVE | LOP_NEWORDER, file, line, NULL);
+ LOP_EXCLUSIVE | LOP_NEWORDER, NULL);
#endif
/*
@@ -133,11 +133,11 @@ ___mp_lock(struct __mp_lock *mpl LOCK_FL_VARS)
__mp_lock_spin(mpl);
}
- WITNESS_LOCK(&mpl->mpl_lock_obj, LOP_EXCLUSIVE, file, line);
+ WITNESS_LOCK(&mpl->mpl_lock_obj, LOP_EXCLUSIVE);
}
void
-___mp_unlock(struct __mp_lock *mpl LOCK_FL_VARS)
+__mp_unlock(struct __mp_lock *mpl)
{
int s;
@@ -149,7 +149,7 @@ ___mp_unlock(struct __mp_lock *mpl LOCK_FL_VARS)
}
#endif
- WITNESS_UNLOCK(&mpl->mpl_lock_obj, LOP_EXCLUSIVE, file, line);
+ WITNESS_UNLOCK(&mpl->mpl_lock_obj, LOP_EXCLUSIVE);
s = hppa_intr_disable();
if (--mpl->mpl_count == 1) {
@@ -161,7 +161,7 @@ ___mp_unlock(struct __mp_lock *mpl LOCK_FL_VARS)
}
int
-___mp_release_all(struct __mp_lock *mpl LOCK_FL_VARS)
+__mp_release_all(struct __mp_lock *mpl)
{
int rv = mpl->mpl_count - 1;
int s;
@@ -179,7 +179,7 @@ ___mp_release_all(struct __mp_lock *mpl LOCK_FL_VARS)
#ifdef WITNESS
for (i = 0; i < rv; i++)
- WITNESS_UNLOCK(&mpl->mpl_lock_obj, LOP_EXCLUSIVE, file, line);
+ WITNESS_UNLOCK(&mpl->mpl_lock_obj, LOP_EXCLUSIVE);
#endif
s = hppa_intr_disable();
@@ -192,7 +192,7 @@ ___mp_release_all(struct __mp_lock *mpl LOCK_FL_VARS)
}
int
-___mp_release_all_but_one(struct __mp_lock *mpl LOCK_FL_VARS)
+__mp_release_all_but_one(struct __mp_lock *mpl)
{
int rv = mpl->mpl_count - 2;
#ifdef WITNESS
@@ -209,7 +209,7 @@ ___mp_release_all_but_one(struct __mp_lock *mpl LOCK_FL_VARS)
#ifdef WITNESS
for (i = 0; i < rv; i++)
- WITNESS_UNLOCK(&mpl->mpl_lock_obj, LOP_EXCLUSIVE, file, line);
+ WITNESS_UNLOCK(&mpl->mpl_lock_obj, LOP_EXCLUSIVE);
#endif
mpl->mpl_count = 2;
@@ -218,10 +218,10 @@ ___mp_release_all_but_one(struct __mp_lock *mpl LOCK_FL_VARS)
}
void
-___mp_acquire_count(struct __mp_lock *mpl, int count LOCK_FL_VARS)
+__mp_acquire_count(struct __mp_lock *mpl, int count)
{
while (count--)
- ___mp_lock(mpl LOCK_FL_ARGS);
+ __mp_lock(mpl);
}
int
diff --git a/sys/arch/hppa/hppa/mutex.c b/sys/arch/hppa/hppa/mutex.c
index 9da3224674d..ff58831e5f1 100644
--- a/sys/arch/hppa/hppa/mutex.c
+++ b/sys/arch/hppa/hppa/mutex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mutex.c,v 1.16 2017/04/20 13:57:29 visa Exp $ */
+/* $OpenBSD: mutex.c,v 1.17 2019/04/23 13:35:12 visa Exp $ */
/*
* Copyright (c) 2004 Artur Grabowski <art@openbsd.org>
@@ -34,8 +34,6 @@
#include <ddb/db_output.h>
-int __mtx_enter_try(struct mutex *);
-
#ifdef MULTIPROCESSOR
/* Note: lock must be 16-byte aligned. */
#define __mtx_lock(mtx) ((int *)(((vaddr_t)mtx->mtx_lock + 0xf) & ~0xf))
@@ -57,14 +55,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)
;
}
int
-__mtx_enter_try(struct mutex *mtx)
+mtx_enter_try(struct mutex *mtx)
{
struct cpu_info *ci = curcpu();
volatile int *lock = __mtx_lock(mtx);
@@ -104,7 +102,7 @@ __mtx_enter_try(struct mutex *mtx)
}
#else
void
-__mtx_enter(struct mutex *mtx)
+mtx_enter(struct mutex *mtx)
{
struct cpu_info *ci = curcpu();
@@ -124,15 +122,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)
{
#ifdef MULTIPROCESSOR
volatile int *lock = __mtx_lock(mtx);
diff --git a/sys/arch/hppa/include/mplock.h b/sys/arch/hppa/include/mplock.h
index 158c1a37df9..b0c2d7299e2 100644
--- a/sys/arch/hppa/include/mplock.h
+++ b/sys/arch/hppa/include/mplock.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mplock.h,v 1.4 2018/06/08 15:38:52 guenther Exp $ */
+/* $OpenBSD: mplock.h,v 1.5 2019/04/23 13:35:12 visa Exp $ */
/*
* Copyright (c) 2004 Niklas Hallqvist. All rights reserved.
@@ -47,11 +47,11 @@ struct __mp_lock {
#ifndef _LOCORE
void ___mp_lock_init(struct __mp_lock *);
-void ___mp_lock(struct __mp_lock * LOCK_FL_VARS);
-void ___mp_unlock(struct __mp_lock * LOCK_FL_VARS);
-int ___mp_release_all(struct __mp_lock * LOCK_FL_VARS);
-int ___mp_release_all_but_one(struct __mp_lock * LOCK_FL_VARS);
-void ___mp_acquire_count(struct __mp_lock *, int LOCK_FL_VARS);
+void __mp_lock(struct __mp_lock *);
+void __mp_unlock(struct __mp_lock *);
+int __mp_release_all(struct __mp_lock *);
+int __mp_release_all_but_one(struct __mp_lock *);
+void __mp_acquire_count(struct __mp_lock *, int);
int __mp_lock_held(struct __mp_lock *, struct cpu_info *);
#ifdef WITNESS
@@ -69,16 +69,6 @@ void _mp_lock_init(struct __mp_lock *, const struct lock_type *);
#endif /* WITNESS */
-#define __mp_lock(mpl) ___mp_lock((mpl) LOCK_FILE_LINE)
-#define __mp_unlock(mpl) ___mp_unlock((mpl) LOCK_FILE_LINE)
-
-#define __mp_release_all(mpl) \
- ___mp_release_all((mpl) LOCK_FILE_LINE)
-#define __mp_release_all_but_one(mpl) \
- ___mp_release_all_but_one((mpl) LOCK_FILE_LINE)
-#define __mp_acquire_count(mpl, count) \
- ___mp_acquire_count((mpl), (count) LOCK_FILE_LINE)
-
#endif
#endif /* !_MACHINE_MPLOCK_H */
diff --git a/sys/arch/m88k/m88k/mutex.S b/sys/arch/m88k/m88k/mutex.S
index 2cc5a3f5a6c..090a8007e2d 100644
--- a/sys/arch/m88k/m88k/mutex.S
+++ b/sys/arch/m88k/m88k/mutex.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: mutex.S,v 1.16 2017/04/20 13:57:30 visa Exp $ */
+/* $OpenBSD: mutex.S,v 1.17 2019/04/23 13:35:12 visa Exp $ */
/*
* Copyright (c) 2005, Miodrag Vallat.
@@ -45,7 +45,7 @@ ENTRY(__mtx_init)
/*
* void mtx_enter(struct mutex *mtx)
*/
-ENTRY(__mtx_enter)
+ENTRY(mtx_enter)
subu %r31, %r31, 8
st %r1, %r31, 4 /* save return address */
@@ -138,7 +138,7 @@ enter_panic:
/*
* int mtx_enter_try(struct mutex *mtx)
*/
-ENTRY(__mtx_enter_try)
+ENTRY(mtx_enter_try)
subu %r31, %r31, 8
st %r1, %r31, 4 /* save return address */
@@ -232,7 +232,7 @@ enter_try_panic:
/*
* void mtx_leave(struct mutex *mtx)
*/
-ENTRY(__mtx_leave)
+ENTRY(mtx_leave)
ld %r3, %r2, MTX_OLDIPL
ld %r4, %r2, MTX_WANTIPL
#ifdef DIAGNOSTIC
diff --git a/sys/arch/sparc64/sparc64/mutex.S b/sys/arch/sparc64/sparc64/mutex.S
index 72816ee273d..62683a472cc 100644
--- a/sys/arch/sparc64/sparc64/mutex.S
+++ b/sys/arch/sparc64/sparc64/mutex.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: mutex.S,v 1.9 2017/04/20 13:57:30 visa Exp $ */
+/* $OpenBSD: mutex.S,v 1.10 2019/04/23 13:35:12 visa Exp $ */
/*
* Copyright (c) 2007 Mark Kettenis
@@ -44,7 +44,7 @@ ENTRY(__mtx_init)
retl
stw %g0, [%o0 + MTX_OLDIPL]
-ENTRY(__mtx_enter)
+ENTRY(mtx_enter)
rdpr %pil, %g4
GET_CURCPU(%g1)
1:
@@ -80,7 +80,7 @@ ENTRY(__mtx_enter)
retl
membar #LoadLoad | #LoadStore
-ENTRY(__mtx_enter_try)
+ENTRY(mtx_enter_try)
rdpr %pil, %g4
GET_CURCPU(%g1)
1:
@@ -112,7 +112,7 @@ ENTRY(__mtx_enter_try)
retl
mov 1, %o0
-ENTRY(__mtx_leave)
+ENTRY(mtx_leave)
#ifdef DIAGNOSTIC
GET_CURCPU(%g1)
ld [%g1 + CI_MUTEX_LEVEL], %g5