diff options
author | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2018-04-06 09:24:25 -0400 |
---|---|---|
committer | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2018-04-07 20:24:40 -0400 |
commit | b0dc52f15e7fe2b973ecfe4f3706f1b35ce3943a (patch) | |
tree | 4166441e144cbb6d3a37119829c379ac73963278 | |
parent | 4e37958d1288ce90e8b8eb526ed93d6b2ee6cf54 (diff) |
init: Have initcall_debug still work without CONFIG_TRACEPOINTS
Add macros around the initcall_debug tracepoint code to have the code to
default back to the old method if CONFIG_TRACEPOINTS is not enabled.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
-rw-r--r-- | init/main.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/init/main.c b/init/main.c index 589d1226016e..6f6e6fc6f4b9 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -496,7 +496,14 @@ void __init __weak mem_encrypt_init(void) { } | |||
496 | 496 | ||
497 | bool initcall_debug; | 497 | bool initcall_debug; |
498 | core_param(initcall_debug, initcall_debug, bool, 0644); | 498 | core_param(initcall_debug, initcall_debug, bool, 0644); |
499 | |||
500 | #ifdef TRACEPOINTS_ENABLED | ||
499 | static void __init initcall_debug_enable(void); | 501 | static void __init initcall_debug_enable(void); |
502 | #else | ||
503 | static inline void initcall_debug_enable(void) | ||
504 | { | ||
505 | } | ||
506 | #endif | ||
500 | 507 | ||
501 | /* | 508 | /* |
502 | * Set up kernel memory allocators | 509 | * Set up kernel memory allocators |
@@ -832,6 +839,7 @@ trace_initcall_finish_cb(void *data, initcall_t fn, int ret) | |||
832 | 839 | ||
833 | static ktime_t initcall_calltime; | 840 | static ktime_t initcall_calltime; |
834 | 841 | ||
842 | #ifdef TRACEPOINTS_ENABLED | ||
835 | static void __init initcall_debug_enable(void) | 843 | static void __init initcall_debug_enable(void) |
836 | { | 844 | { |
837 | int ret; | 845 | int ret; |
@@ -842,6 +850,22 @@ static void __init initcall_debug_enable(void) | |||
842 | &initcall_calltime); | 850 | &initcall_calltime); |
843 | WARN(ret, "Failed to register initcall tracepoints\n"); | 851 | WARN(ret, "Failed to register initcall tracepoints\n"); |
844 | } | 852 | } |
853 | # define do_trace_initcall_start trace_initcall_start | ||
854 | # define do_trace_initcall_finish trace_initcall_finish | ||
855 | #else | ||
856 | static inline void do_trace_initcall_start(initcall_t fn) | ||
857 | { | ||
858 | if (!initcall_debug) | ||
859 | return; | ||
860 | trace_initcall_start_cb(&initcall_calltime, fn); | ||
861 | } | ||
862 | static inline void do_trace_initcall_finish(initcall_t fn, int ret) | ||
863 | { | ||
864 | if (!initcall_debug) | ||
865 | return; | ||
866 | trace_initcall_finish_cb(&initcall_calltime, fn, ret); | ||
867 | } | ||
868 | #endif /* !TRACEPOINTS_ENABLED */ | ||
845 | 869 | ||
846 | int __init_or_module do_one_initcall(initcall_t fn) | 870 | int __init_or_module do_one_initcall(initcall_t fn) |
847 | { | 871 | { |
@@ -852,9 +876,9 @@ int __init_or_module do_one_initcall(initcall_t fn) | |||
852 | if (initcall_blacklisted(fn)) | 876 | if (initcall_blacklisted(fn)) |
853 | return -EPERM; | 877 | return -EPERM; |
854 | 878 | ||
855 | trace_initcall_start(fn); | 879 | do_trace_initcall_start(fn); |
856 | ret = fn(); | 880 | ret = fn(); |
857 | trace_initcall_finish(fn, ret); | 881 | do_trace_initcall_finish(fn, ret); |
858 | 882 | ||
859 | msgbuf[0] = 0; | 883 | msgbuf[0] = 0; |
860 | 884 | ||