* [PATCH] tracing: Skip software disabled event at __synth_event_trace_end()
@ 2020-02-12 5:54 Masami Hiramatsu
2020-02-12 16:03 ` Tom Zanussi
2020-02-17 9:33 ` Masami Hiramatsu
0 siblings, 2 replies; 6+ messages in thread
From: Masami Hiramatsu @ 2020-02-12 5:54 UTC (permalink / raw)
To: Steven Rostedt
Cc: Masami Hiramatsu, Tom Zanussi, artem.bityutskiy, linux-kernel,
linux-rt-users
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.
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
kernel/trace/trace_events_hist.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
index 483b3fd1094f..781e4b55e117 100644
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -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);
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] tracing: Skip software disabled event at __synth_event_trace_end()
2020-02-12 5:54 [PATCH] tracing: Skip software disabled event at __synth_event_trace_end() Masami Hiramatsu
@ 2020-02-12 16:03 ` Tom Zanussi
2020-02-17 9:33 ` Masami Hiramatsu
1 sibling, 0 replies; 6+ messages in thread
From: Tom Zanussi @ 2020-02-12 16:03 UTC (permalink / raw)
To: Masami Hiramatsu, Steven Rostedt
Cc: artem.bityutskiy, linux-kernel, linux-rt-users
Hi Masami,
You're right, this is a bug, thanks for sending the patch to fix it.
Tom
Reviewed-by: Tom Zanussi <zanussi@kernel.org>
On Wed, 2020-02-12 at 14:54 +0900, Masami Hiramatsu 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->disabled at __synth_event_trace_end()
> and if it is disabled, skip it.
>
> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> ---
> kernel/trace/trace_events_hist.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/kernel/trace/trace_events_hist.c
> b/kernel/trace/trace_events_hist.c
> index 483b3fd1094f..781e4b55e117 100644
> --- a/kernel/trace/trace_events_hist.c
> +++ b/kernel/trace/trace_events_hist.c
> @@ -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);
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] tracing: Skip software disabled event at __synth_event_trace_end()
2020-02-12 5:54 [PATCH] tracing: Skip software disabled event at __synth_event_trace_end() Masami Hiramatsu
2020-02-12 16:03 ` Tom Zanussi
@ 2020-02-17 9:33 ` Masami Hiramatsu
2020-02-20 19:34 ` Steven Rostedt
1 sibling, 1 reply; 6+ messages in thread
From: Masami Hiramatsu @ 2020-02-17 9:33 UTC (permalink / raw)
To: Masami Hiramatsu
Cc: Steven Rostedt, Tom Zanussi, artem.bityutskiy, linux-kernel,
linux-rt-users
On Wed, 12 Feb 2020 14:54:19 +0900
Masami Hiramatsu <mhiramat@kernel.org> 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->disabled at __synth_event_trace_end()
> and if it is disabled, skip it.
>
> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> ---
> kernel/trace/trace_events_hist.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
> index 483b3fd1094f..781e4b55e117 100644
> --- a/kernel/trace/trace_events_hist.c
> +++ b/kernel/trace/trace_events_hist.c
> @@ -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,
> trace_event_buffer_commit(&trace_state->fbuffer);
>
> ring_buffer_nest_end(trace_state->buffer);
>
--
Masami Hiramatsu <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] tracing: Skip software disabled event at __synth_event_trace_end()
2020-02-17 9:33 ` Masami Hiramatsu
@ 2020-02-20 19:34 ` Steven Rostedt
2020-02-20 19:51 ` Tom Zanussi
0 siblings, 1 reply; 6+ messages in thread
From: Steven Rostedt @ 2020-02-20 19:34 UTC (permalink / raw)
To: Masami Hiramatsu
Cc: Tom Zanussi, artem.bityutskiy, linux-kernel, linux-rt-users
On Mon, 17 Feb 2020 18:33:40 +0900
Masami Hiramatsu <mhiramat@kernel.org> wrote:
> > 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().
Is this patch good enough to take, or is there another one coming?
-- Steve
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] tracing: Skip software disabled event at __synth_event_trace_end()
2020-02-20 19:34 ` Steven Rostedt
@ 2020-02-20 19:51 ` Tom Zanussi
2020-02-20 19:54 ` Steven Rostedt
0 siblings, 1 reply; 6+ messages in thread
From: Tom Zanussi @ 2020-02-20 19:51 UTC (permalink / raw)
To: Steven Rostedt, Masami Hiramatsu
Cc: artem.bityutskiy, linux-kernel, linux-rt-users
Hi Steve,
On Thu, 2020-02-20 at 14:34 -0500, Steven Rostedt wrote:
> On Mon, 17 Feb 2020 18:33:40 +0900
> Masami Hiramatsu <mhiramat@kernel.org> wrote:
>
> > > 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().
>
> 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-
>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
> -- Steve
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] tracing: Skip software disabled event at __synth_event_trace_end()
2020-02-20 19:51 ` Tom Zanussi
@ 2020-02-20 19:54 ` Steven Rostedt
0 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2020-02-20 19:54 UTC (permalink / raw)
To: Tom Zanussi
Cc: Masami Hiramatsu, artem.bityutskiy, linux-kernel, linux-rt-users
On Thu, 20 Feb 2020 13:51:48 -0600
Tom Zanussi <zanussi@kernel.org> wrote:
> Hi Steve,
>
> On Thu, 2020-02-20 at 14:34 -0500, Steven Rostedt wrote:
> > On Mon, 17 Feb 2020 18:33:40 +0900
> > Masami Hiramatsu <mhiramat@kernel.org> wrote:
> >
> > > > 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().
> >
> > 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-
> >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/
>
Thanks Tom for the info!
-- Steve
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-02-20 19:54 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-12 5:54 [PATCH] tracing: Skip software disabled event at __synth_event_trace_end() Masami Hiramatsu
2020-02-12 16:03 ` Tom Zanussi
2020-02-17 9:33 ` Masami Hiramatsu
2020-02-20 19:34 ` Steven Rostedt
2020-02-20 19:51 ` Tom Zanussi
2020-02-20 19:54 ` Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).