Skip to content

Commit dcf2345

Browse files
tzanussirostedt
authored andcommitted
tracing: Add field modifier parsing hist error for hist triggers
If the user specifies an invalid field modifier for a hist trigger, the current code correctly flags that as an error, but doesn't tell the user what happened. Fix this by invoking hist_err() with an appropriate message when invalid modifiers are specified. Before: # echo 'hist:keys=pid:ts0=common_timestamp.junkusecs' >> /sys/kernel/debug/tracing/events/sched/sched_wakeup/trigger -su: echo: write error: Invalid argument # cat /sys/kernel/debug/tracing/events/sched/sched_wakeup/hist After: # echo 'hist:keys=pid:ts0=common_timestamp.junkusecs' >> /sys/kernel/debug/tracing/events/sched/sched_wakeup/trigger -su: echo: write error: Invalid argument # cat /sys/kernel/debug/tracing/events/sched/sched_wakeup/hist ERROR: Invalid field modifier: junkusecs Last command: keys=pid:ts0=common_timestamp.junkusecs Link: http://lkml.kernel.org/r/b043c59fa79acd06a5f14a1d44dee9e5a3cd1248.1524790601.git.tom.zanussi@linux.intel.com Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
1 parent 5ec432d commit dcf2345

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎kernel/trace/trace_events_hist.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2466,6 +2466,7 @@ parse_field(struct hist_trigger_data *hist_data, struct trace_event_file *file,
24662466
else if (strcmp(modifier, "usecs") == 0)
24672467
*flags |= HIST_FIELD_FL_TIMESTAMP_USECS;
24682468
else {
2469+
hist_err("Invalid field modifier: ", modifier);
24692470
field = ERR_PTR(-EINVAL);
24702471
goto out;
24712472
}

0 commit comments

Comments
 (0)