From: Ross Zwisler <zwisler@google.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
Masami Hiramatsu <mhiramat@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 4/4] tracing: Allow boot instances to have snapshot buffers
Date: Fri, 13 Jan 2023 17:08:09 -0700 [thread overview]
Message-ID: <Y8HyaeNeWvDlBshg@google.com> (raw)
In-Reply-To: <20230111145842.847715402@goodmis.org>
On Wed, Jan 11, 2023 at 09:56:40AM -0500, Steven Rostedt wrote:
> From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
>
> Add to ftrace_boot_snapshot, "=<instance>" name, where the instance will
> get a snapshot buffer, and will take a snapshot at the end of boot (which
> will save the boot traces).
>
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> ---
> .../admin-guide/kernel-parameters.txt | 9 +++
> kernel/trace/trace.c | 77 +++++++++++++++++--
> 2 files changed, 79 insertions(+), 7 deletions(-)
>
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index 7a7f41652719..f4e87b17427f 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -1532,6 +1532,15 @@
> boot up that is likely to be overridden by user space
> start up functionality.
>
> + Optionally, the snapshot can also be defined for a tracing
> + instance that was created by the trace_instance= command
> + line parameter.
> +
> + trace_instance=foo,sched_switch ftrace_boot_snapshot=foo
> +
> + The above will cause the "foo" tracing instance to trigger
> + a snapshot at the end of boot up.
> +
> ftrace_dump_on_oops[=orig_cpu]
> [FTRACE] will dump the trace buffers on oops.
> If no parameter is passed, ftrace will dump
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index 3cb9bbc0f076..d445789dc247 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -192,6 +192,9 @@ static bool snapshot_at_boot;
> static char boot_instance_info[COMMAND_LINE_SIZE] __initdata;
> static int boot_instance_index;
>
> +static char boot_snapshot_info[COMMAND_LINE_SIZE] __initdata;
For x86 machines at least COMMAND_LINE_SIZE is pretty big (2048), so between
boot_instance_info and boot_snapshot_info we are using an entire 4k of memory.
It seems unlikely that any user would need a string this long for these
options. Should we trim this down to something smaller?
> +static int boot_snapshot_index;
> +
> static int __init set_cmdline_ftrace(char *str)
> {
> strlcpy(bootup_tracer_buf, str, MAX_TRACER_SIZE);
> @@ -228,9 +231,22 @@ __setup("traceoff_on_warning", stop_trace_on_warning);
>
> static int __init boot_alloc_snapshot(char *str)
> {
> - allocate_snapshot = true;
> - /* We also need the main ring buffer expanded */
> - ring_buffer_expanded = true;
> + char *slot = boot_snapshot_info + boot_snapshot_index;
> + int left = COMMAND_LINE_SIZE - boot_snapshot_index;
sizeof(boot_snapshot_info) is a bit safer than COMMAND_LINE_SIZE so they don't
get out of sync, plus we may also want to shrink it a bit as mentioned above.
Just two nits, other than that you can add:
Reviewed-by: Ross Zwisler <zwisler@google.com>
next prev parent reply other threads:[~2023-01-14 0:08 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-11 14:56 [PATCH 0/4] tracing: Addition of tracing instances via kernel command line Steven Rostedt
2023-01-11 14:56 ` [PATCH 1/4] tracing: Add creation of instances at boot " Steven Rostedt
2023-01-11 16:33 ` Randy Dunlap
2023-01-12 23:24 ` Ross Zwisler
2023-01-12 23:59 ` Steven Rostedt
2023-01-11 14:56 ` [PATCH 2/4] tracing: Add enabling of events to boot instances Steven Rostedt
2023-01-12 23:24 ` Ross Zwisler
2023-01-11 14:56 ` [PATCH 3/4] tracing: Add trace_array_puts() to write into instance Steven Rostedt
2023-01-12 23:26 ` Ross Zwisler
2023-01-13 0:00 ` Steven Rostedt
2023-01-11 14:56 ` [PATCH 4/4] tracing: Allow boot instances to have snapshot buffers Steven Rostedt
2023-01-11 20:03 ` kernel test robot
2023-01-11 21:34 ` kernel test robot
2023-01-11 23:05 ` kernel test robot
2023-01-11 23:45 ` kernel test robot
2023-01-14 0:08 ` Ross Zwisler [this message]
2023-01-14 4:04 ` 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=Y8HyaeNeWvDlBshg@google.com \
--to=zwisler@google.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--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).