tracing: Add snapshot at end of kernel boot up
Add ftrace_boot_snapshot kernel parameter that will take a snapshot at the end of boot up just before switching over to user space (it happens during the kernel freeing of init memory). This is useful when there's interesting data that can be collected from kernel start up, but gets overridden by user space start up code. With this option, the ring buffer content from the boot up traces gets saved in the snapshot at the end of boot up. This trace can be read from: /sys/kernel/tracing/snapshot Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
This commit is contained in:
@@ -185,6 +185,7 @@ static char bootup_tracer_buf[MAX_TRACER_SIZE] __initdata;
|
||||
static char *default_bootup_tracer;
|
||||
|
||||
static bool allocate_snapshot;
|
||||
static bool snapshot_at_boot;
|
||||
|
||||
static int __init set_cmdline_ftrace(char *str)
|
||||
{
|
||||
@@ -230,6 +231,15 @@ static int __init boot_alloc_snapshot(char *str)
|
||||
__setup("alloc_snapshot", boot_alloc_snapshot);
|
||||
|
||||
|
||||
static int __init boot_snapshot(char *str)
|
||||
{
|
||||
snapshot_at_boot = true;
|
||||
boot_alloc_snapshot(str);
|
||||
return 1;
|
||||
}
|
||||
__setup("ftrace_boot_snapshot", boot_snapshot);
|
||||
|
||||
|
||||
static char trace_boot_options_buf[MAX_TRACER_SIZE] __initdata;
|
||||
|
||||
static int __init set_trace_boot_options(char *str)
|
||||
@@ -10149,6 +10159,14 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
void __init ftrace_boot_snapshot(void)
|
||||
{
|
||||
if (snapshot_at_boot) {
|
||||
tracing_snapshot();
|
||||
internal_trace_puts("** Boot snapshot taken **\n");
|
||||
}
|
||||
}
|
||||
|
||||
void __init early_trace_init(void)
|
||||
{
|
||||
if (tracepoint_printk) {
|
||||
|
||||
Reference in New Issue
Block a user