diff options
-rw-r--r-- | include/linux/ftrace.h | 6 | ||||
-rw-r--r-- | init/main.c | 4 | ||||
-rw-r--r-- | kernel/trace/trace.c | 8 | ||||
-rw-r--r-- | kernel/trace/trace.h | 13 | ||||
-rw-r--r-- | kernel/trace/trace_events.c | 10 | ||||
-rw-r--r-- | kernel/trace/trace_syscalls.c | 7 |
6 files changed, 40 insertions, 8 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index ed501953f0b2..f4bc14b7d444 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h | |||
@@ -39,6 +39,12 @@ | |||
39 | # define FTRACE_FORCE_LIST_FUNC 0 | 39 | # define FTRACE_FORCE_LIST_FUNC 0 |
40 | #endif | 40 | #endif |
41 | 41 | ||
42 | /* Main tracing buffer and events set up */ | ||
43 | #ifdef CONFIG_TRACING | ||
44 | void trace_init(void); | ||
45 | #else | ||
46 | static inline void trace_init(void) { } | ||
47 | #endif | ||
42 | 48 | ||
43 | struct module; | 49 | struct module; |
44 | struct ftrace_hash; | 50 | struct ftrace_hash; |
diff --git a/init/main.c b/init/main.c index 800a0daede7e..70687069f8e2 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -577,6 +577,10 @@ asmlinkage __visible void __init start_kernel(void) | |||
577 | local_irq_disable(); | 577 | local_irq_disable(); |
578 | idr_init_cache(); | 578 | idr_init_cache(); |
579 | rcu_init(); | 579 | rcu_init(); |
580 | |||
581 | /* trace_printk() and trace points may be used after this */ | ||
582 | trace_init(); | ||
583 | |||
580 | context_tracking_init(); | 584 | context_tracking_init(); |
581 | radix_tree_init(); | 585 | radix_tree_init(); |
582 | /* init some links before init_ISA_irqs() */ | 586 | /* init some links before init_ISA_irqs() */ |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 4ceb2546c7ef..ec3ca694665f 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -6876,6 +6876,13 @@ out: | |||
6876 | return ret; | 6876 | return ret; |
6877 | } | 6877 | } |
6878 | 6878 | ||
6879 | void __init trace_init(void) | ||
6880 | { | ||
6881 | tracer_alloc_buffers(); | ||
6882 | init_ftrace_syscalls(); | ||
6883 | trace_event_init(); | ||
6884 | } | ||
6885 | |||
6879 | __init static int clear_boot_tracer(void) | 6886 | __init static int clear_boot_tracer(void) |
6880 | { | 6887 | { |
6881 | /* | 6888 | /* |
@@ -6895,6 +6902,5 @@ __init static int clear_boot_tracer(void) | |||
6895 | return 0; | 6902 | return 0; |
6896 | } | 6903 | } |
6897 | 6904 | ||
6898 | early_initcall(tracer_alloc_buffers); | ||
6899 | fs_initcall(tracer_init_debugfs); | 6905 | fs_initcall(tracer_init_debugfs); |
6900 | late_initcall(clear_boot_tracer); | 6906 | late_initcall(clear_boot_tracer); |
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 3255dfb054a0..c138c149d6ef 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -1301,4 +1301,17 @@ int perf_ftrace_event_register(struct ftrace_event_call *call, | |||
1301 | #define perf_ftrace_event_register NULL | 1301 | #define perf_ftrace_event_register NULL |
1302 | #endif | 1302 | #endif |
1303 | 1303 | ||
1304 | #ifdef CONFIG_FTRACE_SYSCALLS | ||
1305 | void init_ftrace_syscalls(void); | ||
1306 | #else | ||
1307 | static inline void init_ftrace_syscalls(void) { } | ||
1308 | #endif | ||
1309 | |||
1310 | #ifdef CONFIG_EVENT_TRACING | ||
1311 | void trace_event_init(void); | ||
1312 | #else | ||
1313 | static inline void __init trace_event_init(void) { } | ||
1314 | #endif | ||
1315 | |||
1316 | |||
1304 | #endif /* _LINUX_KERNEL_TRACE_H */ | 1317 | #endif /* _LINUX_KERNEL_TRACE_H */ |
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index f9d0cbe014b7..fd9deb0e03f0 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
@@ -2477,8 +2477,14 @@ static __init int event_trace_init(void) | |||
2477 | #endif | 2477 | #endif |
2478 | return 0; | 2478 | return 0; |
2479 | } | 2479 | } |
2480 | early_initcall(event_trace_memsetup); | 2480 | |
2481 | core_initcall(event_trace_enable); | 2481 | void __init trace_event_init(void) |
2482 | { | ||
2483 | event_trace_memsetup(); | ||
2484 | init_ftrace_syscalls(); | ||
2485 | event_trace_enable(); | ||
2486 | } | ||
2487 | |||
2482 | fs_initcall(event_trace_init); | 2488 | fs_initcall(event_trace_init); |
2483 | 2489 | ||
2484 | #ifdef CONFIG_FTRACE_STARTUP_TEST | 2490 | #ifdef CONFIG_FTRACE_STARTUP_TEST |
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c index a72f3d8d813e..ec239771c175 100644 --- a/kernel/trace/trace_syscalls.c +++ b/kernel/trace/trace_syscalls.c | |||
@@ -514,7 +514,7 @@ unsigned long __init __weak arch_syscall_addr(int nr) | |||
514 | return (unsigned long)sys_call_table[nr]; | 514 | return (unsigned long)sys_call_table[nr]; |
515 | } | 515 | } |
516 | 516 | ||
517 | static int __init init_ftrace_syscalls(void) | 517 | void __init init_ftrace_syscalls(void) |
518 | { | 518 | { |
519 | struct syscall_metadata *meta; | 519 | struct syscall_metadata *meta; |
520 | unsigned long addr; | 520 | unsigned long addr; |
@@ -524,7 +524,7 @@ static int __init init_ftrace_syscalls(void) | |||
524 | GFP_KERNEL); | 524 | GFP_KERNEL); |
525 | if (!syscalls_metadata) { | 525 | if (!syscalls_metadata) { |
526 | WARN_ON(1); | 526 | WARN_ON(1); |
527 | return -ENOMEM; | 527 | return; |
528 | } | 528 | } |
529 | 529 | ||
530 | for (i = 0; i < NR_syscalls; i++) { | 530 | for (i = 0; i < NR_syscalls; i++) { |
@@ -536,10 +536,7 @@ static int __init init_ftrace_syscalls(void) | |||
536 | meta->syscall_nr = i; | 536 | meta->syscall_nr = i; |
537 | syscalls_metadata[i] = meta; | 537 | syscalls_metadata[i] = meta; |
538 | } | 538 | } |
539 | |||
540 | return 0; | ||
541 | } | 539 | } |
542 | early_initcall(init_ftrace_syscalls); | ||
543 | 540 | ||
544 | #ifdef CONFIG_PERF_EVENTS | 541 | #ifdef CONFIG_PERF_EVENTS |
545 | 542 | ||