Skip to content

Commit 34f76af

Browse files
tzanussirostedt
authored andcommitted
tracing: Use tracing error_log with trace event filters
Use tracing_log_err() from the new tracing error_log mechanism to send filter parse errors to tracing/error_log. With this change, users will be able to see filter errors by looking at tracing/error_log. The same errors will also be available in the filter file, as expected. Link: http://lkml.kernel.org/r/1d942c419941539a11d78a6810fc5740a99b2974.1554072478.git.tom.zanussi@linux.intel.com Acked-by: Masami Hiramatsu <[email protected]> Acked-by: Namhyung Kim <[email protected]> Signed-off-by: Tom Zanussi <[email protected]> Signed-off-by: Steven Rostedt (VMware) <[email protected]>
1 parent d566c5e commit 34f76af

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

kernel/trace/trace_events_filter.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ static const char * ops[] = { OPS };
6666
C(INVALID_FILTER, "Meaningless filter expression"), \
6767
C(IP_FIELD_ONLY, "Only 'ip' field is supported for function trace"), \
6868
C(INVALID_VALUE, "Invalid value (did you forget quotes)?"), \
69-
C(NO_FILTER, "No filter found"),
69+
C(ERRNO, "Error"), \
70+
C(NO_FILTER, "No filter found")
7071

7172
#undef C
7273
#define C(a, b) FILT_ERR_##a
@@ -76,7 +77,7 @@ enum { ERRORS };
7677
#undef C
7778
#define C(a, b) b
7879

79-
static char *err_text[] = { ERRORS };
80+
static const char *err_text[] = { ERRORS };
8081

8182
/* Called after a '!' character but "!=" and "!~" are not "not"s */
8283
static bool is_not(const char *str)
@@ -947,8 +948,14 @@ static void append_filter_err(struct filter_parse_error *pe,
947948
if (pe->lasterr > 0) {
948949
trace_seq_printf(s, "\n%*s", pos, "^");
949950
trace_seq_printf(s, "\nparse_error: %s\n", err_text[pe->lasterr]);
951+
tracing_log_err("event filter parse error",
952+
filter->filter_string, err_text,
953+
pe->lasterr, pe->lasterr_pos);
950954
} else {
951955
trace_seq_printf(s, "\nError: (%d)\n", pe->lasterr);
956+
tracing_log_err("event filter parse error",
957+
filter->filter_string, err_text,
958+
FILT_ERR_ERRNO, 0);
952959
}
953960
trace_seq_putc(s, 0);
954961
buf = kmemdup_nul(s->buffer, s->seq.len, GFP_KERNEL);

0 commit comments

Comments
 (0)