Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tracing: Restore system filter behavior

Though not all events have field 'prev_pid', it was allowed to do this:

# echo 'prev_pid == 100' > events/sched/filter

but commit 75b8e98263fdb0bfbdeba60d4db463259f1fe8a2 (tracing/filter: Swap
entire filter of events) broke it without any reason.

Link: http://lkml.kernel.org/r/4EAF46CF.8040408@cn.fujitsu.com

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

authored by

Li Zefan and committed by
Steven Rostedt
27b14b56 cb599747

+8 -1
+2
include/linux/ftrace_event.h
··· 172 172 TRACE_EVENT_FL_FILTERED_BIT, 173 173 TRACE_EVENT_FL_RECORDED_CMD_BIT, 174 174 TRACE_EVENT_FL_CAP_ANY_BIT, 175 + TRACE_EVENT_FL_NO_SET_FILTER_BIT, 175 176 }; 176 177 177 178 enum { ··· 180 179 TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT), 181 180 TRACE_EVENT_FL_RECORDED_CMD = (1 << TRACE_EVENT_FL_RECORDED_CMD_BIT), 182 181 TRACE_EVENT_FL_CAP_ANY = (1 << TRACE_EVENT_FL_CAP_ANY_BIT), 182 + TRACE_EVENT_FL_NO_SET_FILTER = (1 << TRACE_EVENT_FL_NO_SET_FILTER_BIT), 183 183 }; 184 184 185 185 struct ftrace_event_call {
+6 -1
kernel/trace/trace_events_filter.c
··· 1649 1649 */ 1650 1650 err = replace_preds(call, NULL, ps, filter_string, true); 1651 1651 if (err) 1652 - goto fail; 1652 + call->flags |= TRACE_EVENT_FL_NO_SET_FILTER; 1653 + else 1654 + call->flags &= ~TRACE_EVENT_FL_NO_SET_FILTER; 1653 1655 } 1654 1656 1655 1657 list_for_each_entry(call, &ftrace_events, list) { 1656 1658 struct event_filter *filter; 1657 1659 1658 1660 if (strcmp(call->class->system, system->name) != 0) 1661 + continue; 1662 + 1663 + if (call->flags & TRACE_EVENT_FL_NO_SET_FILTER) 1659 1664 continue; 1660 1665 1661 1666 filter_item = kzalloc(sizeof(*filter_item), GFP_KERNEL);