diff options
author | Visa Hankala <visa@cvs.openbsd.org> | 2019-04-23 13:35:13 +0000 |
---|---|---|
committer | Visa Hankala <visa@cvs.openbsd.org> | 2019-04-23 13:35:13 +0000 |
commit | db15e483f2f5e75ad8bbfdaf5ee6bff366cddd10 (patch) | |
tree | abd435dbfd3f96ef09966365d12dab45a8073635 /sys/dev/pci/drm | |
parent | ad2ed30d0674bbe8c3cf6f1b4f476b382b9e35cb (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/dev/pci/drm')
-rw-r--r-- | sys/dev/pci/drm/include/linux/completion.h | 49 | ||||
-rw-r--r-- | sys/dev/pci/drm/include/linux/spinlock.h | 22 | ||||
-rw-r--r-- | sys/dev/pci/drm/include/linux/wait.h | 13 |
3 files changed, 33 insertions, 51 deletions
diff --git a/sys/dev/pci/drm/include/linux/completion.h b/sys/dev/pci/drm/include/linux/completion.h index 051c3d7613a..ac8a9dc0826 100644 --- a/sys/dev/pci/drm/include/linux/completion.h +++ b/sys/dev/pci/drm/include/linux/completion.h @@ -1,4 +1,4 @@ -/* $OpenBSD: completion.h,v 1.1 2019/04/14 10:14:53 jsg Exp $ */ +/* $OpenBSD: completion.h,v 1.2 2019/04/23 13:35:12 visa Exp $ */ /* * Copyright (c) 2015, 2018 Mark Kettenis * @@ -36,97 +36,88 @@ init_completion(struct completion *x) } static inline u_long -_wait_for_completion_timeout(struct completion *x, u_long timo LOCK_FL_VARS) +wait_for_completion_timeout(struct completion *x, u_long timo) { int ret; KASSERT(!cold); - _mtx_enter(&x->wait.lock LOCK_FL_ARGS); + mtx_enter(&x->wait.lock); while (x->done == 0) { ret = msleep(x, &x->wait.lock, 0, "wfct", timo); if (ret) { - _mtx_leave(&x->wait.lock LOCK_FL_ARGS); + mtx_leave(&x->wait.lock); return (ret == EWOULDBLOCK) ? 0 : -ret; } } x->done--; - _mtx_leave(&x->wait.lock LOCK_FL_ARGS); + mtx_leave(&x->wait.lock); return 1; } -#define wait_for_completion_timeout(x, timo) \ - _wait_for_completion_timeout(x, timo LOCK_FILE_LINE) static inline u_long -_wait_for_completion_interruptible(struct completion *x LOCK_FL_VARS) +wait_for_completion_interruptible(struct completion *x) { int ret; KASSERT(!cold); - _mtx_enter(&x->wait.lock LOCK_FL_ARGS); + mtx_enter(&x->wait.lock); while (x->done == 0) { ret = msleep(x, &x->wait.lock, PCATCH, "wfci", 0); if (ret) { - _mtx_leave(&x->wait.lock LOCK_FL_ARGS); + mtx_leave(&x->wait.lock); return (ret == EWOULDBLOCK) ? 0 : -ret; } } x->done--; - _mtx_leave(&x->wait.lock LOCK_FL_ARGS); + mtx_leave(&x->wait.lock); return 0; } -#define wait_for_completion_interruptible(x) \ - _wait_for_completion_interruptible(x LOCK_FILE_LINE) static inline u_long -_wait_for_completion_interruptible_timeout(struct completion *x, u_long timo - LOCK_FL_VARS) +wait_for_completion_interruptible_timeout(struct completion *x, u_long timo) { int ret; KASSERT(!cold); - _mtx_enter(&x->wait.lock LOCK_FL_ARGS); + mtx_enter(&x->wait.lock); while (x->done == 0) { ret = msleep(x, &x->wait.lock, PCATCH, "wfcit", timo); if (ret) { - _mtx_leave(&x->wait.lock LOCK_FL_ARGS); + mtx_leave(&x->wait.lock); return (ret == EWOULDBLOCK) ? 0 : -ret; } } x->done--; - _mtx_leave(&x->wait.lock LOCK_FL_ARGS); + mtx_leave(&x->wait.lock); return 1; } -#define wait_for_completion_interruptible_timeout(x, timo) \ - _wait_for_completion_interruptible_timeout(x, timo LOCK_FILE_LINE) static inline void -_complete_all(struct completion *x LOCK_FL_VARS) +complete_all(struct completion *x) { - _mtx_enter(&x->wait.lock LOCK_FL_ARGS); + mtx_enter(&x->wait.lock); x->done = UINT_MAX; - _mtx_leave(&x->wait.lock LOCK_FL_ARGS); + mtx_leave(&x->wait.lock); wakeup(x); } -#define complete_all(x) _complete_all(x LOCK_FILE_LINE) static inline bool -_try_wait_for_completion(struct completion *x LOCK_FL_VARS) +try_wait_for_completion(struct completion *x) { - _mtx_enter(&x->wait.lock LOCK_FL_ARGS); + mtx_enter(&x->wait.lock); if (x->done == 0) { - _mtx_leave(&x->wait.lock LOCK_FL_ARGS); + mtx_leave(&x->wait.lock); return false; } x->done--; - _mtx_leave(&x->wait.lock LOCK_FL_ARGS); + mtx_leave(&x->wait.lock); return true; } -#define try_wait_for_completion(x) _try_wait_for_completion(x LOCK_FILE_LINE) #endif diff --git a/sys/dev/pci/drm/include/linux/spinlock.h b/sys/dev/pci/drm/include/linux/spinlock.h index acf04cd96b9..14dc60ebfe2 100644 --- a/sys/dev/pci/drm/include/linux/spinlock.h +++ b/sys/dev/pci/drm/include/linux/spinlock.h @@ -9,29 +9,21 @@ #include <linux/bottom_half.h> static inline void -_spin_lock_irqsave(struct mutex *mtxp, __unused unsigned long flags - LOCK_FL_VARS) +spin_lock_irqsave(struct mutex *mtxp, __unused unsigned long flags) { - _mtx_enter(mtxp LOCK_FL_ARGS); + mtx_enter(mtxp); } static inline void -_spin_lock_irqsave_nested(struct mutex *mtxp, __unused unsigned long flags, - __unused int subclass LOCK_FL_VARS) +spin_lock_irqsave_nested(struct mutex *mtxp, __unused unsigned long flags, + __unused int subclass) { - _mtx_enter(mtxp LOCK_FL_ARGS); + mtx_enter(mtxp); } static inline void -_spin_unlock_irqrestore(struct mutex *mtxp, __unused unsigned long flags - LOCK_FL_VARS) +spin_unlock_irqrestore(struct mutex *mtxp, __unused unsigned long flags) { - _mtx_leave(mtxp LOCK_FL_ARGS); + mtx_leave(mtxp); } -#define spin_lock_irqsave(m, fl) \ - _spin_lock_irqsave(m, fl LOCK_FILE_LINE) -#define spin_lock_irqsave_nested(m, fl, subc) \ - _spin_lock_irqsave_nested(m, fl, subc LOCK_FILE_LINE) -#define spin_unlock_irqrestore(m, fl) \ - _spin_unlock_irqrestore(m, fl LOCK_FILE_LINE) #define spin_lock(mtxp) mtx_enter(mtxp) #define spin_lock_nested(mtxp, l) mtx_enter(mtxp) diff --git a/sys/dev/pci/drm/include/linux/wait.h b/sys/dev/pci/drm/include/linux/wait.h index 5c8ef223f02..af91716f457 100644 --- a/sys/dev/pci/drm/include/linux/wait.h +++ b/sys/dev/pci/drm/include/linux/wait.h @@ -1,4 +1,4 @@ -/* $OpenBSD: wait.h,v 1.1 2019/04/14 10:14:53 jsg Exp $ */ +/* $OpenBSD: wait.h,v 1.2 2019/04/23 13:35:12 visa Exp $ */ /* * Copyright (c) 2013, 2014, 2015 Mark Kettenis * Copyright (c) 2017 Martin Pieuchot @@ -193,22 +193,21 @@ do { \ }) static inline void -_wake_up(wait_queue_head_t *wqh LOCK_FL_VARS) +wake_up(wait_queue_head_t *wqh) { wait_queue_entry_t *wqe; wait_queue_entry_t *tmp; - _mtx_enter(&wqh->lock LOCK_FL_ARGS); + mtx_enter(&wqh->lock); list_for_each_entry_safe(wqe, tmp, &wqh->head, entry) { if (wqe->func != NULL) wqe->func(wqe, 0, wqe->flags, NULL); } wakeup(wqh); - _mtx_leave(&wqh->lock LOCK_FL_ARGS); + mtx_leave(&wqh->lock); } -#define wake_up(wq) _wake_up(wq LOCK_FILE_LINE) -#define wake_up_all(wq) _wake_up(wq LOCK_FILE_LINE) +#define wake_up_all(wq) wake_up(wq) static inline void wake_up_all_locked(wait_queue_head_t *wqh) @@ -223,7 +222,7 @@ wake_up_all_locked(wait_queue_head_t *wqh) wakeup(wqh); } -#define wake_up_interruptible(wq) _wake_up(wq LOCK_FILE_LINE) +#define wake_up_interruptible(wq) wake_up(wq) #define waitqueue_active(wq) ((wq)->count > 0) #define DEFINE_WAIT(name) \ |