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>,
	Mark Rutland <mark.rutland@arm.com>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Subject: Re: [PATCH] tracing: Increase size of trace_marker_raw to max ring buffer entry
Date: Mon, 11 Dec 2023 21:14:24 +0900	[thread overview]
Message-ID: <20231211211424.e58f9b9abb9594f671d1d0ed@kernel.org> (raw)
In-Reply-To: <20231209175716.09ac455b@gandalf.local.home>

On Sat, 9 Dec 2023 17:57:16 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:

> From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
> 
> There's no reason to give an arbitrary limit to the size of a raw trace
> marker. Just let it be as big as the size that is allowed by the ring
> buffer itself.
> 
> And there's also no reason to artificially break up the write to
> TRACE_BUF_SIZE, as that's not even used.

Looks good to me.

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

Thanks!

> 
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> ---
> [
>   Depends on: https://lore.kernel.org/linux-trace-kernel/20231209175003.63db40ab@gandalf.local.home/
> ]
>  kernel/trace/trace.c | 13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index da837119a446..077b20e83e7c 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -7351,9 +7351,6 @@ tracing_mark_write(struct file *filp, const char __user *ubuf,
>  	return written;
>  }
>  
> -/* Limit it for now to 3K (including tag) */
> -#define RAW_DATA_MAX_SIZE (1024*3)
> -
>  static ssize_t
>  tracing_mark_raw_write(struct file *filp, const char __user *ubuf,
>  					size_t cnt, loff_t *fpos)
> @@ -7375,18 +7372,16 @@ tracing_mark_raw_write(struct file *filp, const char __user *ubuf,
>  		return -EINVAL;
>  
>  	/* The marker must at least have a tag id */
> -	if (cnt < sizeof(unsigned int) || cnt > RAW_DATA_MAX_SIZE)
> +	if (cnt < sizeof(unsigned int))
>  		return -EINVAL;
>  
> -	if (cnt > TRACE_BUF_SIZE)
> -		cnt = TRACE_BUF_SIZE;
> -
> -	BUILD_BUG_ON(TRACE_BUF_SIZE >= PAGE_SIZE);
> -
>  	size = sizeof(*entry) + cnt;
>  	if (cnt < FAULT_SIZE_ID)
>  		size += FAULT_SIZE_ID - cnt;
>  
> +	if (size > ring_buffer_max_event_size(buffer))
> +		return -EINVAL;
> +
>  	buffer = tr->array_buffer.buffer;
>  	event = __trace_buffer_lock_reserve(buffer, TRACE_RAW_DATA, size,
>  					    tracing_gen_ctx());
> -- 
> 2.42.0
> 


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

      reply	other threads:[~2023-12-11 12:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-09 22:57 [PATCH] tracing: Increase size of trace_marker_raw to max ring buffer entry Steven Rostedt
2023-12-11 12:14 ` 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=20231211211424.e58f9b9abb9594f671d1d0ed@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=rostedt@goodmis.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 NNTP newsgroup(s).