From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: [for-next][PATCH 06/10] tracing: Increase size of trace_marker_raw to max ring buffer entry
Date: Tue, 19 Dec 2023 09:32:39 -0500 [thread overview]
Message-ID: <20231219143300.487404467@goodmis.org> (raw)
In-Reply-To: 20231219143233.204534014@goodmis.org
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.
Link: https://lore.kernel.org/linux-trace-kernel/20231213104218.2efc70c1@gandalf.local.home
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
kernel/trace/trace.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 9cf58383d2fb..55dabee4c78b 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -7365,9 +7365,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)
@@ -7389,19 +7386,18 @@ 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;
buffer = tr->array_buffer.buffer;
+
+ if (size > ring_buffer_max_event_size(buffer))
+ return -EINVAL;
+
event = __trace_buffer_lock_reserve(buffer, TRACE_RAW_DATA, size,
tracing_gen_ctx());
if (!event)
--
2.42.0
next prev parent reply other threads:[~2023-12-19 14:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-19 14:32 [for-next][PATCH 00/10] tracing: Updates for 6.8 Steven Rostedt
2023-12-19 14:32 ` [for-next][PATCH 01/10] tracing: Allow creating instances with specified system events Steven Rostedt
2023-12-19 14:32 ` [for-next][PATCH 02/10] ring-buffer: Add offset of events in dump on mismatch Steven Rostedt
2023-12-19 14:32 ` [for-next][PATCH 03/10] tracing: Allow for max buffer data size trace_marker writes Steven Rostedt
2023-12-19 14:32 ` [for-next][PATCH 04/10] trace_seq: Increase the buffer size to almost two pages Steven Rostedt
2023-12-19 14:32 ` [for-next][PATCH 05/10] tracing: Have trace_marker break up by lines by size of trace_seq Steven Rostedt
2023-12-19 14:32 ` Steven Rostedt [this message]
2023-12-19 14:32 ` [for-next][PATCH 07/10] tracing/selftests: Add test to test the trace_marker Steven Rostedt
2023-12-19 14:32 ` [for-next][PATCH 08/10] ring-buffer: Remove 32bit timestamp logic Steven Rostedt
2023-12-19 14:32 ` [for-next][PATCH 09/10] ring-buffer: Add interrupt information to dump of data sub-buffer Steven Rostedt
2023-12-19 14:32 ` [for-next][PATCH 10/10] ring-buffer: Check if absolute timestamp goes backwards Steven Rostedt
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=20231219143300.487404467@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.