tracing: Skip software disabled event at __synth_event_trace_end()
Masami Hiramatsu
maintainerPATCH 1/1 tracing: Skip software disabled event at __synth_event_trace_end()
When the synthetic event is software disabled, __synth_event_trace_start() does not allocate an event buffer. In this case __synth_event_trace_end() also should not commit the buffer.
Check the trace_state->disabled at __synth_event_trace_end() and if it is disabled, skip it.
--- kernel/trace/trace_events_hist.c | 3 +++ 1 file changed, 3 insertions(+)
kernel/trace/trace_events_hist.c +3 -0
@@ -1847,6 +1847,9 @@ __synth_event_trace_start(struct trace_event_file *file,static inline void __synth_event_trace_end (struct synth_event_trace_state *trace_state) { +if (trace_state->disabled) +return ; +trace_event_buffer_commit (&trace_state->fbuffer);ring_buffer_nest_end (trace_state->buffer);
Hi Masami,
You're right, this is a bug, thanks for sending the patch to fix it.
Tom
Quoted 30 lines · Masami Hiramatsu
When the synthetic event is software disabled,
__synth_event_trace_start()does not allocate an event buffer. In this case__synth_event_trace_end()also should not commit the buffer.Check the
trace_state->disabledat__synth_event_trace_end()and if it is disabled, skip it.Signed-off-by Masami Hiramatsu <[email protected]>--- kernel/trace/trace_events_hist.c | 3 +++ 1 file changed, 3 insertions(+)kernel/trace/trace_events_hist.c +3
-0@@ -1847,6 +1847,9 @@ __synth_event_trace_start(structtrace_event_file *file, static inline void __synth_event_trace_end(struct synth_event_trace_state *trace_state) { + if (trace_state->disabled) + return; + trace_event_buffer_commit(&trace_state->fbuffer);
ring_buffer_nest_end(trace_state->buffer);
Masami Hiramatsu
maintainerQuoted 18 lines · On Wed, 12 Feb 2020 14:54:19 +0900 Masami Hiramatsu <[email protected]> wrote:
When the synthetic event is software disabled,
__synth_event_trace_start()does not allocate an event buffer. In this case__synth_event_trace_end()also should not commit the buffer.Check the
trace_state->disabledat__synth_event_trace_end()and if it is disabled, skip it.Signed-off-by Masami Hiramatsu <[email protected]>--- kernel/trace/trace_events_hist.c | 3 +++ 1 file changed, 3 insertions(+)kernel/trace/trace_events_hist.c +0
-0
kernel/trace/trace_events_hist.c __synth_event_trace_start(struct trace_event_file *file, · line 1852
Quoted 6 lines
kernel/trace/trace_events_hist.c +3
-0@@ -1847,6 +1847,9 @@ __synth_event_trace_start(struct trace_event_file *file,static inline void __synth_event_trace_end (struct synth_event_trace_state *trace_state) { +if (trace_state->disabled) +return ; +
Aah, I assumed that trace_state should be initialized with 0, but in really, it could be just allocated on the stack.
We has to set trace_state->disabled = false in __synth_event_trace_start().
Thank you,
Quoted 4 lines
kernel/trace/trace_events_hist.c +0
-0trace_event_buffer_commit (&trace_state->fbuffer);ring_buffer_nest_end (trace_state->buffer);
Signature · 1 line
Masami Hiramatsu <[email protected]>
Steven Rostedt
maintainerQuoted 10 lines · On Mon, 17 Feb 2020 18:33:40 +0900 Masami Hiramatsu <[email protected]> wrote:
kernel/trace/trace_events_hist.c __synth_event_trace_start(struct trace_event_file *file, · line 1852
Quoted 6 lines
static inline void
__synth_event_trace_end(struct synth_event_trace_state *trace_state){kernel/trace/trace_events_hist.c +3
-0+if (trace_state->disabled) +return ; +Aah, I assumed that
trace_stateshould be initialized with 0, but in really, it could be just allocated on the stack.
We has to settrace_state->disabled= false in__synth_event_trace_start().
Is this patch good enough to take, or is there another one coming?
-- Steve
Hi Steve,
Quoted 16 lines · Steven Rostedt
Quoted 4 lines · On Mon, 17 Feb 2020 18:33:40 +0900 Masami Hiramatsu <[email protected]> wrote:
Quoted 4 lines
static inline void __synth_event_trace_end(struct
synth_event_trace_state*trace_state)
{Quoted 8 lines
kernel/trace/trace_events_hist.c __synth_event_trace_start(struct trace_event_file *file, · line 1852
Quoted 3 lines
kernel/trace/trace_events_hist.c +3
-0+if (trace_state->disabled) +return ; +Aah, I assumed that
trace_stateshould be initialized with 0, but in really, it could be just allocated on the stack.
We has to settrace_state->disabled= false in__synth_event_trace_start().
Quoted 2 lines
Is this patch good enough to take, or is there another one coming?
I think this patch is good to take. The fix for setting trace_state-
Quoted 1 line
disabled to false would be covered by this later patch:
[PATCH 2/2] tracing: Clear trace_state when starting trace
https://lore.kernel.org/lkml/158193315899.8868.1781259176894639952.stgit@devnote2/
Tom
Quoted 1 line
-- Steve
Steven Rostedt
maintainerQuoted 22 lines · On Thu, 20 Feb 2020 13:51:48 -0600 Tom Zanussi <[email protected]> wrote:
Hi Steve,
Quoted 16 lines · Steven Rostedt
Quoted 4 lines · On Mon, 17 Feb 2020 18:33:40 +0900 Masami Hiramatsu <[email protected]> wrote:
Quoted 4 lines
static inline void __synth_event_trace_end(struct
synth_event_trace_state*trace_state)
{Quoted 8 lines
kernel/trace/trace_events_hist.c __synth_event_trace_start(struct trace_event_file *file, · line 1852
Quoted 3 lines
kernel/trace/trace_events_hist.c +3
-0+if (trace_state->disabled) +return ; +Aah, I assumed that
trace_stateshould be initialized with 0, but in really, it could be just allocated on the stack.
We has to settrace_state->disabled= false in__synth_event_trace_start().Quoted 2 lines
Is this patch good enough to take, or is there another one coming?
Quoted 7 lines
I think this patch is good to take. The fix for setting trace_state-
Quoted 1 line
disabled to false would be covered by this later patch:
[PATCH 2/2] tracing: Clear
trace_statewhen starting tracehttps://lore.kernel.org/lkml/158193315899.8868.1781259176894639952.stgit@devnote2/
Thanks Tom for the info!
-- Steve