diff options
author | Attilio Rao <attilio@FreeBSD.org> | 2013-11-25 07:38:45 +0000 |
---|---|---|
committer | Attilio Rao <attilio@FreeBSD.org> | 2013-11-25 07:38:45 +0000 |
commit | 54366c0bd7d0ea904fb9ab32460c66d57684a7cb (patch) | |
tree | e29b308276ced8b2028470c376a2a34193dc6c3c /sys/kern | |
parent | 7c5b23111c5fd1992047922d4247c4a1ce1bb6c3 (diff) | |
download | src-54366c0bd7d0ea904fb9ab32460c66d57684a7cb.tar.gz src-54366c0bd7d0ea904fb9ab32460c66d57684a7cb.zip |
- 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
Notes
Notes:
svn path=/head/; revision=258541
Diffstat (limited to 'sys/kern')
30 files changed, 0 insertions, 42 deletions
diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c index 4cfd219590b8..99de8dbe872e 100644 --- a/sys/kern/kern_clock.c +++ b/sys/kern/kern_clock.c @@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$"); #include "opt_kdb.h" #include "opt_device_polling.h" #include "opt_hwpmc_hooks.h" -#include "opt_kdtrace.h" #include "opt_ntp.h" #include "opt_watchdog.h" diff --git a/sys/kern/kern_clocksource.c b/sys/kern/kern_clocksource.c index c2bebbeeb956..0aa71bd73726 100644 --- a/sys/kern/kern_clocksource.c +++ b/sys/kern/kern_clocksource.c @@ -32,7 +32,6 @@ __FBSDID("$FreeBSD$"); */ #include "opt_device_polling.h" -#include "opt_kdtrace.h" #include <sys/param.h> #include <sys/systm.h> diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index c71c66607da0..1a668145a8a9 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -29,7 +29,6 @@ __FBSDID("$FreeBSD$"); #include "opt_capsicum.h" #include "opt_hwpmc_hooks.h" -#include "opt_kdtrace.h" #include "opt_ktrace.h" #include "opt_vm.h" diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 1a68bf5e9fe0..ab2610d7e468 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$"); #include "opt_compat.h" -#include "opt_kdtrace.h" #include "opt_ktrace.h" #include "opt_procdesc.h" diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index de7f09fd6ca6..11160ce4d51f 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -37,7 +37,6 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -#include "opt_kdtrace.h" #include "opt_ktrace.h" #include "opt_kstack_pages.h" #include "opt_procdesc.h" diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c index 8ca8acd130c8..5b6910656746 100644 --- a/sys/kern/kern_lock.c +++ b/sys/kern/kern_lock.c @@ -29,7 +29,6 @@ #include "opt_adaptive_lockmgrs.h" #include "opt_ddb.h" #include "opt_hwpmc_hooks.h" -#include "opt_kdtrace.h" #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); diff --git a/sys/kern/kern_lockstat.c b/sys/kern/kern_lockstat.c index 1f3589331f58..1c773128da99 100644 --- a/sys/kern/kern_lockstat.c +++ b/sys/kern/kern_lockstat.c @@ -32,8 +32,6 @@ * */ -#include "opt_kdtrace.h" - #ifdef KDTRACE_HOOKS #include <sys/time.h> diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index a5d25ea55032..464cbad79872 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$"); #include "opt_ddb.h" -#include "opt_kdtrace.h" #include "opt_vm.h" #include <sys/param.h> diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c index e61a187319f9..d0b47e5374b8 100644 --- a/sys/kern/kern_mutex.c +++ b/sys/kern/kern_mutex.c @@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$"); #include "opt_ddb.h" #include "opt_global.h" #include "opt_hwpmc_hooks.h" -#include "opt_kdtrace.h" #include "opt_sched.h" #include <sys/param.h> @@ -249,8 +248,6 @@ __mtx_unlock_flags(volatile uintptr_t *c, int opts, const char *file, int line) line); mtx_assert(m, MA_OWNED); - if (m->mtx_recurse == 0) - LOCKSTAT_PROFILE_RELEASE_LOCK(LS_MTX_UNLOCK_RELEASE, m); __mtx_unlock(m, curthread, opts, file, line); curthread->td_locks--; } diff --git a/sys/kern/kern_priv.c b/sys/kern/kern_priv.c index 4d266ab3ecc1..a1e977f02f97 100644 --- a/sys/kern/kern_priv.c +++ b/sys/kern/kern_priv.c @@ -28,8 +28,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "opt_kdtrace.h" - #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 9968e7639019..ece250afad5f 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -34,7 +34,6 @@ __FBSDID("$FreeBSD$"); #include "opt_compat.h" #include "opt_ddb.h" -#include "opt_kdtrace.h" #include "opt_ktrace.h" #include "opt_kstack_pages.h" #include "opt_stack.h" diff --git a/sys/kern/kern_racct.c b/sys/kern/kern_racct.c index d31c8328a594..012429a7e572 100644 --- a/sys/kern/kern_racct.c +++ b/sys/kern/kern_racct.c @@ -32,7 +32,6 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -#include "opt_kdtrace.h" #include "opt_sched.h" #include <sys/param.h> diff --git a/sys/kern/kern_rmlock.c b/sys/kern/kern_rmlock.c index ec0e7fa5fd8c..d93aa158461a 100644 --- a/sys/kern/kern_rmlock.c +++ b/sys/kern/kern_rmlock.c @@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$"); #include "opt_ddb.h" -#include "opt_kdtrace.h" #include <sys/param.h> #include <sys/systm.h> diff --git a/sys/kern/kern_rwlock.c b/sys/kern/kern_rwlock.c index 7b1e6bfba5e1..0e9f3a53920b 100644 --- a/sys/kern/kern_rwlock.c +++ b/sys/kern/kern_rwlock.c @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #include "opt_ddb.h" #include "opt_hwpmc_hooks.h" -#include "opt_kdtrace.h" #include "opt_no_adaptive_rwlocks.h" #include <sys/param.h> @@ -322,8 +321,6 @@ _rw_wunlock_cookie(volatile uintptr_t *c, const char *file, int line) WITNESS_UNLOCK(&rw->lock_object, LOP_EXCLUSIVE, file, line); LOCK_LOG_LOCK("WUNLOCK", &rw->lock_object, 0, rw->rw_recurse, file, line); - if (!rw_recursed(rw)) - LOCKSTAT_PROFILE_RELEASE_LOCK(LS_RW_WUNLOCK_RELEASE, rw); __rw_wunlock(rw, curthread, file, line); curthread->td_locks--; } diff --git a/sys/kern/kern_sdt.c b/sys/kern/kern_sdt.c index c8e1940fbd71..460944de0dfc 100644 --- a/sys/kern/kern_sdt.c +++ b/sys/kern/kern_sdt.c @@ -25,8 +25,6 @@ * $FreeBSD$ */ -#include "opt_kdtrace.h" - #include <sys/param.h> #include <sys/systm.h> #include <sys/sdt.h> diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index ea4ac261470e..7f0c82023179 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$"); #include "opt_compat.h" -#include "opt_kdtrace.h" #include "opt_ktrace.h" #include "opt_core.h" #include "opt_procdesc.h" diff --git a/sys/kern/kern_sx.c b/sys/kern/kern_sx.c index a1fc36a9f3dd..8154b20c494e 100644 --- a/sys/kern/kern_sx.c +++ b/sys/kern/kern_sx.c @@ -38,7 +38,6 @@ #include "opt_ddb.h" #include "opt_hwpmc_hooks.h" -#include "opt_kdtrace.h" #include "opt_no_adaptive_sx.h" #include <sys/cdefs.h> @@ -109,7 +108,6 @@ PMC_SOFT_DECLARE( , , lock, failed); * Returns true if an exclusive lock is recursed. It assumes * curthread currently has an exclusive lock. */ -#define sx_recurse lock_object.lo_data #define sx_recursed(sx) ((sx)->sx_recurse != 0) static void assert_sx(const struct lock_object *lock, int what); @@ -365,7 +363,6 @@ _sx_sunlock(struct sx *sx, const char *file, int line) WITNESS_UNLOCK(&sx->lock_object, 0, file, line); LOCK_LOG_LOCK("SUNLOCK", &sx->lock_object, 0, 0, file, line); __sx_sunlock(sx, file, line); - LOCKSTAT_PROFILE_RELEASE_LOCK(LS_SX_SUNLOCK_RELEASE, sx); curthread->td_locks--; } @@ -381,8 +378,6 @@ _sx_xunlock(struct sx *sx, const char *file, int line) WITNESS_UNLOCK(&sx->lock_object, LOP_EXCLUSIVE, file, line); LOCK_LOG_LOCK("XUNLOCK", &sx->lock_object, 0, sx->sx_recurse, file, line); - if (!sx_recursed(sx)) - LOCKSTAT_PROFILE_RELEASE_LOCK(LS_SX_XUNLOCK_RELEASE, sx); __sx_xunlock(sx, curthread, file, line); curthread->td_locks--; } diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index 047fa46a630b..198f9057ba5b 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -37,7 +37,6 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -#include "opt_kdtrace.h" #include "opt_ktrace.h" #include "opt_sched.h" diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index 5da4866d6387..f3271aff7985 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -27,7 +27,6 @@ */ #include "opt_witness.h" -#include "opt_kdtrace.h" #include "opt_hwpmc_hooks.h" #include <sys/cdefs.h> diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c index 98a6df339f66..c925dfc813e1 100644 --- a/sys/kern/kern_timeout.c +++ b/sys/kern/kern_timeout.c @@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$"); #include "opt_callout_profiling.h" -#include "opt_kdtrace.h" #if defined(__arm__) #include "opt_timer.h" #endif diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c index 7c7d48118e52..7b9a1a68a0fe 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$"); #include "opt_hwpmc_hooks.h" #include "opt_sched.h" -#include "opt_kdtrace.h" #include <sys/param.h> #include <sys/systm.h> diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index cba9d804a3ab..5e6d35811de8 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$"); #include "opt_hwpmc_hooks.h" -#include "opt_kdtrace.h" #include "opt_sched.h" #include <sys/param.h> diff --git a/sys/kern/subr_devstat.c b/sys/kern/subr_devstat.c index f5cb27fb85f2..7cb2ed006f1e 100644 --- a/sys/kern/subr_devstat.c +++ b/sys/kern/subr_devstat.c @@ -29,8 +29,6 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -#include "opt_kdtrace.h" - #include <sys/param.h> #include <sys/kernel.h> #include <sys/systm.h> diff --git a/sys/kern/subr_sleepqueue.c b/sys/kern/subr_sleepqueue.c index 92b51477e09d..c385b319f81c 100644 --- a/sys/kern/subr_sleepqueue.c +++ b/sys/kern/subr_sleepqueue.c @@ -64,7 +64,6 @@ __FBSDID("$FreeBSD$"); #include "opt_sleepqueue_profiling.h" #include "opt_ddb.h" -#include "opt_kdtrace.h" #include "opt_sched.h" #include <sys/param.h> diff --git a/sys/kern/subr_syscall.c b/sys/kern/subr_syscall.c index 3d6dc5ad9066..c06661eb890d 100644 --- a/sys/kern/subr_syscall.c +++ b/sys/kern/subr_syscall.c @@ -40,7 +40,6 @@ #include "opt_capsicum.h" #include "opt_ktrace.h" -#include "opt_kdtrace.h" __FBSDID("$FreeBSD$"); diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c index 19729a46356c..65a31cdaeec8 100644 --- a/sys/kern/subr_trap.c +++ b/sys/kern/subr_trap.c @@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$"); #include "opt_hwpmc_hooks.h" #include "opt_ktrace.h" -#include "opt_kdtrace.h" #include "opt_sched.h" #include <sys/param.h> diff --git a/sys/kern/subr_turnstile.c b/sys/kern/subr_turnstile.c index 0a21ad929496..6d0341c86f8c 100644 --- a/sys/kern/subr_turnstile.c +++ b/sys/kern/subr_turnstile.c @@ -60,7 +60,6 @@ __FBSDID("$FreeBSD$"); #include "opt_ddb.h" -#include "opt_kdtrace.h" #include "opt_turnstile_profiling.h" #include "opt_sched.h" diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 31ed545c495e..b931ed72721b 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -35,7 +35,6 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -#include "opt_kdtrace.h" #include "opt_ktrace.h" #include <sys/param.h> diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index fbca5d8f7a32..99bd77656858 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$"); #include "opt_capsicum.h" -#include "opt_kdtrace.h" #include "opt_ktrace.h" #include <sys/param.h> diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 4b82df8d7ef5..ee068731d41e 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$"); #include "opt_capsicum.h" #include "opt_compat.h" -#include "opt_kdtrace.h" #include "opt_ktrace.h" #include <sys/param.h> |