linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Ross Zwisler <zwisler@google.com>
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 23:04:06 -0500	[thread overview]
Message-ID: <20230113230406.6a8cd992@gandalf.local.home> (raw)
In-Reply-To: <Y8HyaeNeWvDlBshg@google.com>

On Fri, 13 Jan 2023 17:08:09 -0700
Ross Zwisler <zwisler@google.com> wrote:

> > +++ 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?

They are both empty (BSS) and initdata. So they get allocated at boot up
and freed at the end of boot.

> 
> > +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.

Yeah, I'm willing to do this (as mentioned before).

> 
> Just two nits, other than that you can add:
> 
> Reviewed-by: Ross Zwisler <zwisler@google.com>

Thanks!

-- Steve

      reply	other threads:[~2023-01-14  4:04 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
2023-01-14  4:04     ` Steven Rostedt [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=20230113230406.6a8cd992@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=zwisler@google.com \
    /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).