summaryrefslogtreecommitdiffstats
path: root/kernel/trace/ftrace.c
diff options
context:
space:
mode:
authorSteven Rostedt (VMware) <rostedt@goodmis.org>2020-03-25 19:51:19 -0400
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2020-03-27 16:39:02 -0400
commit2768362603018da2be44ae4d01f22406152db05a (patch)
tree7dddfe9c57c87e56138f14a8d01611ea7e1fff66 /kernel/trace/ftrace.c
parentb3b1e6ededa4337940adba6cf06e8351056e3097 (diff)
downloadlinux-2768362603018da2be44ae4d01f22406152db05a.tar.bz2
tracing: Create set_event_notrace_pid to not trace tasks
There's currently a way to select a task that should only have its events traced, but there's no way to select a task not to have itsevents traced. Add a set_event_notrace_pid file that acts the same as set_event_pid (and is also affected by event-fork), but the task pids in this file will not be traced even if they are listed in the set_event_pid file. This makes it easy for tools like trace-cmd to "hide" itself from beint traced by events when it is recording other tasks. Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/ftrace.c')
-rw-r--r--kernel/trace/ftrace.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 7239d9acd09f..0bb62e64280c 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -6987,11 +6987,6 @@ void ftrace_pid_follow_fork(struct trace_array *tr, bool enable)
}
}
-enum {
- TRACE_PIDS = BIT(0),
- TRACE_NO_PIDS = BIT(1),
-};
-
static void clear_ftrace_pids(struct trace_array *tr, int type)
{
struct trace_pid_list *pid_list;
@@ -7004,13 +6999,11 @@ static void clear_ftrace_pids(struct trace_array *tr, int type)
lockdep_is_held(&ftrace_lock));
/* Make sure there's something to do */
- if (!(((type & TRACE_PIDS) && pid_list) ||
- ((type & TRACE_NO_PIDS) && no_pid_list)))
+ if (!pid_type_enabled(type, pid_list, no_pid_list))
return;
/* See if the pids still need to be checked after this */
- if (!((!(type & TRACE_PIDS) && pid_list) ||
- (!(type & TRACE_NO_PIDS) && no_pid_list))) {
+ if (!still_need_pid_events(type, pid_list, no_pid_list)) {
unregister_trace_sched_switch(ftrace_filter_pid_sched_switch_probe, tr);
for_each_possible_cpu(cpu)
per_cpu_ptr(tr->array_buffer.data, cpu)->ftrace_ignore_pid = FTRACE_PID_TRACE;