[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOxpaSU7EPHi6Z4PccTkuPJah8C04Tx54gv9e=WcAhbLEKgtwA@mail.gmail.com>
Date: Wed, 5 Oct 2022 10:07:42 -0600
From: Ross Zwisler <zwisler@...nel.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH v2] tracing: Do not free snapshot if tracer is on cmdline
On Wed, Oct 5, 2022 at 9:37 AM Steven Rostedt <rostedt@...dmis.org> wrote:
>
> From: "Steven Rostedt (Google)" <rostedt@...dmis.org>
>
> The ftrace_boot_snapshot and alloc_snapshot cmdline options allocate the
> snapshot buffer at boot up for use later. The ftrace_boot_snapshot in
> particular requires the snapshot to be allocated because it will take a
> snapshot at the end of boot up allowing to see the traces that happened
> during boot so that it's not lost when user space takes over.
>
> When a tracer is registered (started) there's a path that checks if it
> requires the snapshot buffer or not, and if it does not and it was
> allocated it will do a synchronization and free the snapshot buffer.
>
> This is only required if the previous tracer was using it for "max
> latency" snapshots, as it needs to make sure all max snapshots are
> complete before freeing. But this is only needed if the previous tracer
> was using the snapshot buffer for latency (like irqoff tracer and
> friends). But it does not make sense to free it, if the previous tracer
> was not using it, and the snapshot was allocated by the cmdline
> parameters. This basically takes away the point of allocating it in the
> first place!
>
> Note, the allocated snapshot worked fine for just trace events, but fails
> when a tracer is enabled on the cmdline.
>
> Further investigation, this goes back even further and it does not require
> a tracer on the cmdline to fail. Simply enable snapshots and then enable a
> tracer, and it will remove the snapshot.
>
> Cc: Masami Hiramatsu <mhiramat@...nel.org>
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Cc: stable@...r.kernel.org
> Fixes: 45ad21ca5530 ("tracing: Have trace_array keep track if snapshot buffer is allocated")
> Reported-by: Ross Zwisler <zwisler@...nel.org>
With this patch I'm able to successfully use the function_graph tracer
with boot snapshots, thanks!
Tested-by: Ross Zwisler <zwisler@...nel.org>
Powered by blists - more mailing lists