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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'trace-fixes-v4.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace

Pull tracing fix from Steven Rostedt:
"A feature was added in 4.3 that allowed users to filter trace points
on a tasks "comm" field. But this prevented filtering on a comm field
that is within a trace event (like sched_migrate_task).

When trying to filter on when a program migrated, this change
prevented the filtering of the sched_migrate_task.

To fix this, the event fields are examined first, and then the extra
fields like "comm" and "cpu" are examined. Also, instead of testing
to assign the comm filter function based on the field's name, the
generic comm field is given a new filter type (FILTER_COMM). When
this field is used to filter the type is checked. The same is done
for the cpu filter field.

Two new special filter types are added: "COMM" and "CPU". This allows
users to still filter the tasks comm for events that have "comm" as
one of their fields, in cases that users would like to filter
sched_migrate_task on the comm of the task that called the event, and
not the comm of the task that is being migrated"

* tag 'trace-fixes-v4.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
tracing: Do not have 'comm' filter override event 'comm' field

+19 -14
+2
include/linux/trace_events.h
··· 568 568 FILTER_DYN_STRING, 569 569 FILTER_PTR_STRING, 570 570 FILTER_TRACE_FN, 571 + FILTER_COMM, 572 + FILTER_CPU, 571 573 }; 572 574 573 575 extern int trace_event_raw_init(struct trace_event_call *call);
+10 -8
kernel/trace/trace_events.c
··· 97 97 struct ftrace_event_field *field; 98 98 struct list_head *head; 99 99 100 + head = trace_get_fields(call); 101 + field = __find_event_field(head, name); 102 + if (field) 103 + return field; 104 + 100 105 field = __find_event_field(&ftrace_generic_fields, name); 101 106 if (field) 102 107 return field; 103 108 104 - field = __find_event_field(&ftrace_common_fields, name); 105 - if (field) 106 - return field; 107 - 108 - head = trace_get_fields(call); 109 - return __find_event_field(head, name); 109 + return __find_event_field(&ftrace_common_fields, name); 110 110 } 111 111 112 112 static int __trace_define_field(struct list_head *head, const char *type, ··· 171 171 { 172 172 int ret; 173 173 174 - __generic_field(int, cpu, FILTER_OTHER); 175 - __generic_field(char *, comm, FILTER_PTR_STRING); 174 + __generic_field(int, CPU, FILTER_CPU); 175 + __generic_field(int, cpu, FILTER_CPU); 176 + __generic_field(char *, COMM, FILTER_COMM); 177 + __generic_field(char *, comm, FILTER_COMM); 176 178 177 179 return ret; 178 180 }
+7 -6
kernel/trace/trace_events_filter.c
··· 1043 1043 return -EINVAL; 1044 1044 } 1045 1045 1046 - if (is_string_field(field)) { 1046 + if (field->filter_type == FILTER_COMM) { 1047 + filter_build_regex(pred); 1048 + fn = filter_pred_comm; 1049 + pred->regex.field_len = TASK_COMM_LEN; 1050 + } else if (is_string_field(field)) { 1047 1051 filter_build_regex(pred); 1048 1052 1049 - if (!strcmp(field->name, "comm")) { 1050 - fn = filter_pred_comm; 1051 - pred->regex.field_len = TASK_COMM_LEN; 1052 - } else if (field->filter_type == FILTER_STATIC_STRING) { 1053 + if (field->filter_type == FILTER_STATIC_STRING) { 1053 1054 fn = filter_pred_string; 1054 1055 pred->regex.field_len = field->size; 1055 1056 } else if (field->filter_type == FILTER_DYN_STRING) ··· 1073 1072 } 1074 1073 pred->val = val; 1075 1074 1076 - if (!strcmp(field->name, "cpu")) 1075 + if (field->filter_type == FILTER_CPU) 1077 1076 fn = filter_pred_cpu; 1078 1077 else 1079 1078 fn = select_comparison_fn(pred->op, field->size,