* [PATCH] tracing: Have trace_marker break up by lines by size of trace_seq
@ 2023-12-13 0:04 Steven Rostedt
2023-12-13 0:19 ` Masami Hiramatsu
0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2023-12-13 0:04 UTC (permalink / raw)
To: LKML, Linux Trace Kernel
Cc: Masami Hiramatsu, Mark Rutland, Mathieu Desnoyers
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
If a trace_marker write is bigger than what trace_seq can hold, then it
will print "LINE TOO BIG" message and not what was written.
Instead, if check if the write is bigger than the trace_seq and break it
up by that size.
Ideally, we could make the trace_seq dynamic that could hold this. But
that's for another time.
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
kernel/trace/trace.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 893e749713d3..2a21bc840fe7 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -7298,6 +7298,11 @@ tracing_mark_write(struct file *filp, const char __user *ubuf,
if (cnt < FAULTED_SIZE)
size += FAULTED_SIZE - cnt;
+ if (size > TRACE_SEQ_BUFFER_SIZE) {
+ cnt -= size - TRACE_SEQ_BUFFER_SIZE;
+ goto again;
+ }
+
buffer = tr->array_buffer.buffer;
event = __trace_buffer_lock_reserve(buffer, TRACE_PRINT, size,
tracing_gen_ctx());
--
2.42.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] tracing: Have trace_marker break up by lines by size of trace_seq
2023-12-13 0:04 [PATCH] tracing: Have trace_marker break up by lines by size of trace_seq Steven Rostedt
@ 2023-12-13 0:19 ` Masami Hiramatsu
2023-12-13 0:26 ` Steven Rostedt
0 siblings, 1 reply; 3+ messages in thread
From: Masami Hiramatsu @ 2023-12-13 0:19 UTC (permalink / raw)
To: Steven Rostedt
Cc: LKML, Linux Trace Kernel, Masami Hiramatsu, Mark Rutland,
Mathieu Desnoyers
On Tue, 12 Dec 2023 19:04:22 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:
> From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
>
> If a trace_marker write is bigger than what trace_seq can hold, then it
> will print "LINE TOO BIG" message and not what was written.
>
> Instead, if check if the write is bigger than the trace_seq and break it
Instead, check if ... ?
> up by that size.
>
> Ideally, we could make the trace_seq dynamic that could hold this. But
> that's for another time.
I think this is OK, but if possible it is better to be merged with the
"LINE TOO BIG" patch (by updating the version).
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Thank you,
>
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> ---
> kernel/trace/trace.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index 893e749713d3..2a21bc840fe7 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -7298,6 +7298,11 @@ tracing_mark_write(struct file *filp, const char __user *ubuf,
> if (cnt < FAULTED_SIZE)
> size += FAULTED_SIZE - cnt;
>
> + if (size > TRACE_SEQ_BUFFER_SIZE) {
> + cnt -= size - TRACE_SEQ_BUFFER_SIZE;
> + goto again;
> + }
> +
> buffer = tr->array_buffer.buffer;
> event = __trace_buffer_lock_reserve(buffer, TRACE_PRINT, size,
> tracing_gen_ctx());
> --
> 2.42.0
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] tracing: Have trace_marker break up by lines by size of trace_seq
2023-12-13 0:19 ` Masami Hiramatsu
@ 2023-12-13 0:26 ` Steven Rostedt
0 siblings, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2023-12-13 0:26 UTC (permalink / raw)
To: Masami Hiramatsu (Google)
Cc: LKML, Linux Trace Kernel, Mark Rutland, Mathieu Desnoyers
On Wed, 13 Dec 2023 09:19:33 +0900
Masami Hiramatsu (Google) <mhiramat@kernel.org> wrote:
> On Tue, 12 Dec 2023 19:04:22 -0500
> Steven Rostedt <rostedt@goodmis.org> wrote:
>
> > From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
> >
> > If a trace_marker write is bigger than what trace_seq can hold, then it
> > will print "LINE TOO BIG" message and not what was written.
> >
> > Instead, if check if the write is bigger than the trace_seq and break it
>
> Instead, check if ... ?
Ah yes, thank you.
>
> > up by that size.
> >
> > Ideally, we could make the trace_seq dynamic that could hold this. But
> > that's for another time.
>
> I think this is OK, but if possible it is better to be merged with the
> "LINE TOO BIG" patch (by updating the version).
What do you mean by "updating the version"?
Note, the LINE TOO BIG doesn't happen today. It only happens when applying
the sub buffer resize change, and then when I run the tests, it breaks when
the subbuffer is bigger than the trace_seq.
>
> Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Thanks!
-- Steve
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-12-13 0:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-13 0:04 [PATCH] tracing: Have trace_marker break up by lines by size of trace_seq Steven Rostedt
2023-12-13 0:19 ` Masami Hiramatsu
2023-12-13 0:26 ` Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox