aboutsummaryrefslogtreecommitdiffstats
path: root/include/trace
diff options
context:
space:
mode:
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>2013-03-12 13:26:18 -0400
committerSteven Rostedt <rostedt@goodmis.org>2013-03-15 00:36:03 -0400
commit417944c4c7a0f657158d0515f3b8e8c043fd788f (patch)
tree838e9bb09f8df63af3adf5b865d3781eeac8d6ba /include/trace
parent7818b3886545f89549185e4023743e2df91d1fa1 (diff)
tracing: Add a way to soft disable trace events
In order to let triggers enable or disable events, we need a 'soft' method for doing so. For example, if a function probe is added that lets a user enable or disable events when a function is called, that change must be done without taking locks or a mutex, and definitely it can't sleep. But the full enabling of a tracepoint is expensive. By adding a 'SOFT_DISABLE' flag, and converting the flags to be updated without the protection of a mutex (using set/clear_bit()), this soft disable flag can be used to allow critical sections to enable or disable events from being traced (after the event has been placed into "SOFT_MODE"). Some caveats though: The comm recorder (to map pids with a comm) can not be soft disabled (yet). If you disable an event with with a "soft" disable and wait a while before reading the trace, the comm cache may be replaced and you'll get a bunch of <...> for comms in the trace. Reading the "enable" file for an event that is disabled will now give you "0*" where the '*' denotes that the tracepoint is still active but the event itself is "disabled". [ fixed _BIT used in & operation : thanks to Dan Carpenter and smatch ] Cc: Dan Carpenter <dan.carpenter@oracle.com> Cc: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'include/trace')
-rw-r--r--include/trace/ftrace.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index bbf09c2021b9..4bda044e6c77 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -413,6 +413,10 @@ static inline notrace int ftrace_get_offsets_##call( \
413 * int __data_size; 413 * int __data_size;
414 * int pc; 414 * int pc;
415 * 415 *
416 * if (test_bit(FTRACE_EVENT_FL_SOFT_DISABLED_BIT,
417 * &ftrace_file->flags))
418 * return;
419 *
416 * local_save_flags(irq_flags); 420 * local_save_flags(irq_flags);
417 * pc = preempt_count(); 421 * pc = preempt_count();
418 * 422 *
@@ -518,6 +522,10 @@ ftrace_raw_event_##call(void *__data, proto) \
518 int __data_size; \ 522 int __data_size; \
519 int pc; \ 523 int pc; \
520 \ 524 \
525 if (test_bit(FTRACE_EVENT_FL_SOFT_DISABLED_BIT, \
526 &ftrace_file->flags)) \
527 return; \
528 \
521 local_save_flags(irq_flags); \ 529 local_save_flags(irq_flags); \
522 pc = preempt_count(); \ 530 pc = preempt_count(); \
523 \ 531 \