Skip to content

Commit ed0449a

Browse files
Li Zefanrostedt
authored andcommitted
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 75b8e98 (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>
1 parent d631097 commit ed0449a

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

‎include/linux/ftrace_event.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,15 @@ enum {
172172
TRACE_EVENT_FL_FILTERED_BIT,
173173
TRACE_EVENT_FL_RECORDED_CMD_BIT,
174174
TRACE_EVENT_FL_CAP_ANY_BIT,
175+
TRACE_EVENT_FL_NO_SET_FILTER_BIT,
175176
};
176177

177178
enum {
178179
TRACE_EVENT_FL_ENABLED = (1 << TRACE_EVENT_FL_ENABLED_BIT),
179180
TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT),
180181
TRACE_EVENT_FL_RECORDED_CMD = (1 << TRACE_EVENT_FL_RECORDED_CMD_BIT),
181182
TRACE_EVENT_FL_CAP_ANY = (1 << TRACE_EVENT_FL_CAP_ANY_BIT),
183+
TRACE_EVENT_FL_NO_SET_FILTER = (1 << TRACE_EVENT_FL_NO_SET_FILTER_BIT),
182184
};
183185

184186
struct ftrace_event_call {

‎kernel/trace/trace_events_filter.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1649,7 +1649,9 @@ static int replace_system_preds(struct event_subsystem *system,
16491649
*/
16501650
err = replace_preds(call, NULL, ps, filter_string, true);
16511651
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;
16531655
}
16541656

16551657
list_for_each_entry(call, &ftrace_events, list) {
@@ -1658,6 +1660,9 @@ static int replace_system_preds(struct event_subsystem *system,
16581660
if (strcmp(call->class->system, system->name) != 0)
16591661
continue;
16601662

1663+
if (call->flags & TRACE_EVENT_FL_NO_SET_FILTER)
1664+
continue;
1665+
16611666
filter_item = kzalloc(sizeof(*filter_item), GFP_KERNEL);
16621667
if (!filter_item)
16631668
goto fail_mem;

0 commit comments

Comments
 (0)