Skip to content

Commit ba0fbfb

Browse files
mhiramatrostedt
authored andcommitted
tracing/boot, kprobe, synth: Initialize boot-time tracing earlier
Initialize boot-time tracing in core_initcall_sync instead of fs_initcall, and initialize required tracers (kprobes and synth) in core_initcall. This will allow the boot-time tracing to trace __init code from the beginning of postcore_initcall stage. Link: https://lkml.kernel.org/r/159974155727.478751.7486926132902849578.stgit@devnote2 Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
1 parent 4114fbf commit ba0fbfb

3 files changed

Lines changed: 22 additions & 10 deletions

File tree

‎kernel/trace/trace_boot.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,5 +340,8 @@ static int __init trace_boot_init(void)
340340

341341
return 0;
342342
}
343-
344-
fs_initcall(trace_boot_init);
343+
/*
344+
* Start tracing at the end of core-initcall, so that it starts tracing
345+
* from the beginning of postcore_initcall.
346+
*/
347+
core_initcall_sync(trace_boot_init);

‎kernel/trace/trace_events_synth.c‎

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1754,17 +1754,26 @@ static const struct file_operations synth_events_fops = {
17541754
.release = seq_release,
17551755
};
17561756

1757-
static __init int trace_events_synth_init(void)
1757+
/*
1758+
* Register dynevent at core_initcall. This allows kernel to setup kprobe
1759+
* events in postcore_initcall without tracefs.
1760+
*/
1761+
static __init int trace_events_synth_init_early(void)
17581762
{
1759-
struct dentry *entry = NULL;
17601763
int err = 0;
17611764

17621765
err = dyn_event_register(&synth_event_ops);
1763-
if (err) {
1766+
if (err)
17641767
pr_warn("Could not register synth_event_ops\n");
1765-
return err;
1766-
}
17671768

1769+
return err;
1770+
}
1771+
core_initcall(trace_events_synth_init_early);
1772+
1773+
static __init int trace_events_synth_init(void)
1774+
{
1775+
struct dentry *entry = NULL;
1776+
int err = 0;
17681777
err = tracing_init_dentry();
17691778
if (err)
17701779
goto err;

‎kernel/trace/trace_kprobe.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1897,8 +1897,8 @@ static __init void setup_boot_kprobe_events(void)
18971897
}
18981898

18991899
/*
1900-
* Register dynevent at subsys_initcall. This allows kernel to setup kprobe
1901-
* events in fs_initcall without tracefs.
1900+
* Register dynevent at core_initcall. This allows kernel to setup kprobe
1901+
* events in postcore_initcall without tracefs.
19021902
*/
19031903
static __init int init_kprobe_trace_early(void)
19041904
{
@@ -1913,7 +1913,7 @@ static __init int init_kprobe_trace_early(void)
19131913

19141914
return 0;
19151915
}
1916-
subsys_initcall(init_kprobe_trace_early);
1916+
core_initcall(init_kprobe_trace_early);
19171917

19181918
/* Make a tracefs interface for controlling probe points */
19191919
static __init int init_kprobe_trace(void)

0 commit comments

Comments
 (0)