Skip to content

Commit 0c62f6c

Browse files
Tom Zanussirostedt
authored andcommitted
tracing: Don't return -EINVAL when tracing soft disabled synth events
There's no reason to return -EINVAL when tracing a synthetic event if it's soft disabled - treat it the same as if it were hard disabled and return normally. Have synth_event_trace() and synth_event_trace_array() just return normally, and have synth_event_trace_start set the trace state to disabled and return. Link: http://lkml.kernel.org/r/df5d02a1625aff97c9866506c5bada6a069982ba.1581374549.git.zanussi@kernel.org Fixes: 8dcc53a ("tracing: Add synth_event_trace() and related functions") Signed-off-by: Tom Zanussi <[email protected]> Signed-off-by: Steven Rostedt (VMware) <[email protected]>
1 parent d090409 commit 0c62f6c

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

kernel/trace/trace_events_hist.c

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1828,17 +1828,15 @@ int synth_event_trace(struct trace_event_file *file, unsigned int n_vals, ...)
18281828
* called directly by the user, we don't have that but we
18291829
* still need to honor not logging when disabled.
18301830
*/
1831-
if (!(file->flags & EVENT_FILE_FL_ENABLED))
1831+
if (!(file->flags & EVENT_FILE_FL_ENABLED) ||
1832+
trace_trigger_soft_disabled(file))
18321833
return 0;
18331834

18341835
event = file->event_call->data;
18351836

18361837
if (n_vals != event->n_fields)
18371838
return -EINVAL;
18381839

1839-
if (trace_trigger_soft_disabled(file))
1840-
return -EINVAL;
1841-
18421840
fields_size = event->n_u64 * sizeof(u64);
18431841

18441842
/*
@@ -1918,17 +1916,15 @@ int synth_event_trace_array(struct trace_event_file *file, u64 *vals,
19181916
* called directly by the user, we don't have that but we
19191917
* still need to honor not logging when disabled.
19201918
*/
1921-
if (!(file->flags & EVENT_FILE_FL_ENABLED))
1919+
if (!(file->flags & EVENT_FILE_FL_ENABLED) ||
1920+
trace_trigger_soft_disabled(file))
19221921
return 0;
19231922

19241923
event = file->event_call->data;
19251924

19261925
if (n_vals != event->n_fields)
19271926
return -EINVAL;
19281927

1929-
if (trace_trigger_soft_disabled(file))
1930-
return -EINVAL;
1931-
19321928
fields_size = event->n_u64 * sizeof(u64);
19331929

19341930
/*
@@ -2017,7 +2013,8 @@ int synth_event_trace_start(struct trace_event_file *file,
20172013
* trace case, we save the enabed state upon start and just
20182014
* ignore the following data calls.
20192015
*/
2020-
if (!(file->flags & EVENT_FILE_FL_ENABLED)) {
2016+
if (!(file->flags & EVENT_FILE_FL_ENABLED) ||
2017+
trace_trigger_soft_disabled(file)) {
20212018
trace_state->enabled = false;
20222019
goto out;
20232020
}
@@ -2026,11 +2023,6 @@ int synth_event_trace_start(struct trace_event_file *file,
20262023

20272024
trace_state->event = file->event_call->data;
20282025

2029-
if (trace_trigger_soft_disabled(file)) {
2030-
ret = -EINVAL;
2031-
goto out;
2032-
}
2033-
20342026
fields_size = trace_state->event->n_u64 * sizeof(u64);
20352027

20362028
/*

0 commit comments

Comments
 (0)