linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Linux Trace Kernel <linux-trace-kernel@vger.kernel.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Sachin Sant <sachinp@linux.ibm.com>
Subject: Re: [PATCH] tracing: Limit trace_seq size to just 8K and not depend on architecture PAGE_SIZE
Date: Thu, 11 Apr 2024 08:12:58 +0900	[thread overview]
Message-ID: <20240411081258.d96952359c857461278d6559@kernel.org> (raw)
In-Reply-To: <20240304191342.56fb1087@gandalf.local.home>

On Mon, 4 Mar 2024 19:13:42 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:

> From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
> 
> The trace_seq buffer is used to print out entire events. It's typically
> set to PAGE_SIZE * 2 as there's some events that can be quite large.
> 
> As a side effect, writes to trace_marker is limited by both the size of the
> trace_seq buffer as well as the ring buffer's sub-buffer size (which is a
> power of PAGE_SIZE). By limiting the trace_seq size, it also limits the
> size of the largest string written to trace_marker.
> 
> trace_seq does not need to be dependent on PAGE_SIZE like the ring buffer
> sub-buffers need to be. Hard code it to 8K which is PAGE_SIZE * 2 on most
> architectures. This will also limit the size of trace_marker on those
> architectures with greater than 4K PAGE_SIZE.
> 
> Link: https://lore.kernel.org/all/20240302111244.3a1674be@gandalf.local.home/
> 

8K is reasonably enough big. Looks good to me.

Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>

Thank you,


> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> ---
>  include/linux/trace_seq.h | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/trace_seq.h b/include/linux/trace_seq.h
> index 9ec229dfddaa..1ef95c0287f0 100644
> --- a/include/linux/trace_seq.h
> +++ b/include/linux/trace_seq.h
> @@ -9,9 +9,15 @@
>  /*
>   * Trace sequences are used to allow a function to call several other functions
>   * to create a string of data to use.
> + *
> + * Have the trace seq to be 8K which is typically PAGE_SIZE * 2 on
> + * most architectures. The TRACE_SEQ_BUFFER_SIZE (which is
> + * TRACE_SEQ_SIZE minus the other fields of trace_seq), is the
> + * max size the output of a trace event may be.
>   */
>  
> -#define TRACE_SEQ_BUFFER_SIZE	(PAGE_SIZE * 2 - \
> +#define TRACE_SEQ_SIZE		8192
> +#define TRACE_SEQ_BUFFER_SIZE	(TRACE_SEQ_SIZE - \
>  	(sizeof(struct seq_buf) + sizeof(size_t) + sizeof(int)))
>  
>  struct trace_seq {
> -- 
> 2.43.0
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

      reply	other threads:[~2024-04-10 23:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-05  0:13 [PATCH] tracing: Limit trace_seq size to just 8K and not depend on architecture PAGE_SIZE Steven Rostedt
2024-04-10 23:12 ` Masami Hiramatsu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240411081258.d96952359c857461278d6559@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=rostedt@goodmis.org \
    --cc=sachinp@linux.ibm.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).