summaryrefslogtreecommitdiffstats
path: root/sys/sys/mutex.h
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2013-11-25 07:38:45 +0000
committerattilio <attilio@FreeBSD.org>2013-11-25 07:38:45 +0000
commit7ee4e910ced4b311b0194fe11c664f0c6bde3bd8 (patch)
treee29b308276ced8b2028470c376a2a34193dc6c3c /sys/sys/mutex.h
parent150d294dbc6b55504998d6f99781473171415f7f (diff)
downloadFreeBSD-src-7ee4e910ced4b311b0194fe11c664f0c6bde3bd8.zip
FreeBSD-src-7ee4e910ced4b311b0194fe11c664f0c6bde3bd8.tar.gz
- For kernel compiled only with KDTRACE_HOOKS and not any lock debugging
option, unbreak the lock tracing release semantic by embedding calls to LOCKSTAT_PROFILE_RELEASE_LOCK() direclty in the inlined version of the releasing functions for mutex, rwlock and sxlock. Failing to do so skips the lockstat_probe_func invokation for unlocking. - As part of the LOCKSTAT support is inlined in mutex operation, for kernel compiled without lock debugging options, potentially every consumer must be compiled including opt_kdtrace.h. Fix this by moving KDTRACE_HOOKS into opt_global.h and remove the dependency by opt_kdtrace.h for all files, as now only KDTRACE_FRAMES is linked there and it is only used as a compile-time stub [0]. [0] immediately shows some new bug as DTRACE-derived support for debug in sfxge is broken and it was never really tested. As it was not including correctly opt_kdtrace.h before it was never enabled so it was kept broken for a while. Fix this by using a protection stub, leaving sfxge driver authors the responsibility for fixing it appropriately [1]. Sponsored by: EMC / Isilon storage division Discussed with: rstone [0] Reported by: rstone [1] Discussed with: philip
Diffstat (limited to 'sys/sys/mutex.h')
-rw-r--r--sys/sys/mutex.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/sys/mutex.h b/sys/sys/mutex.h
index 1c9d5d5..39d8f45 100644
--- a/sys/sys/mutex.h
+++ b/sys/sys/mutex.h
@@ -229,6 +229,9 @@ void thread_lock_flags_(struct thread *, int, const char *, int);
#define __mtx_unlock(mp, tid, opts, file, line) do { \
uintptr_t _tid = (uintptr_t)(tid); \
\
+ if ((mp)->mtx_recurse == 0) \
+ LOCKSTAT_PROFILE_RELEASE_LOCK(LS_MTX_UNLOCK_RELEASE, \
+ (mp)); \
if (!_mtx_release_lock((mp), _tid)) \
_mtx_unlock_sleep((mp), (opts), (file), (line)); \
} while (0)
OpenPOWER on IntegriCloud