]> git.baikalelectronics.ru Git - kernel.git/commit
tracing: Do not have 'comm' filter override event 'comm' field
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>
Thu, 3 Mar 2016 22:18:20 +0000 (17:18 -0500)
committerSteven Rostedt <rostedt@goodmis.org>
Fri, 4 Mar 2016 14:57:10 +0000 (09:57 -0500)
commit07adc1bd646455f1e55f55a1fa5228779e720121
treea3ec2acf045e5f9ec191f391a501fae096f4ca9a
parent3832d8799befa6a8bfd4bae1ca38f501ee0e214c
tracing: Do not have 'comm' filter override event 'comm' field

Commit cf837fe0ed969 "tracing: Allow triggers to filter for CPU ids and
process names" added a 'comm' filter that will filter events based on the
current tasks struct 'comm'. But this now hides the ability to filter events
that have a 'comm' field too. For example, sched_migrate_task trace event.
That has a 'comm' field of the task to be migrated.

 echo 'comm == "bash"' > events/sched_migrate_task/filter

will now filter all sched_migrate_task events for tasks named "bash" that
migrates other tasks (in interrupt context), instead of seeing when "bash"
itself gets migrated.

This fix requires a couple of changes.

1) Change the look up order for filter predicates to look at the events
   fields before looking at the generic filters.

2) Instead of basing the filter function off of the "comm" name, have the
   generic "comm" filter have its own filter_type (FILTER_COMM). Test
   against the type instead of the name to assign the filter function.

3) Add a new "COMM" filter that works just like "comm" but will filter based
   on the current task, even if the trace event contains a "comm" field.

Do the same for "cpu" field, adding a FILTER_CPU and a filter "CPU".

Cc: stable@vger.kernel.org # v4.3+
Fixes: cf837fe0ed969 "tracing: Allow triggers to filter for CPU ids and process names"
Reported-by: Matt Fleming <matt@codeblueprint.co.uk>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
include/linux/trace_events.h
kernel/trace/trace_events.c
kernel/trace/trace_events_filter.c