diff options
-rw-r--r-- | Documentation/kernel-parameters.txt | 5 | ||||
-rw-r--r-- | Documentation/trace/events.txt | 9 | ||||
-rw-r--r-- | kernel/trace/trace.c | 4 | ||||
-rw-r--r-- | kernel/trace/trace.h | 3 | ||||
-rw-r--r-- | kernel/trace/trace_events.c | 37 |
5 files changed, 52 insertions, 6 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index d3f41db3ed49..2582e7aea29f 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -2478,6 +2478,11 @@ and is between 256 and 4096 characters. It is defined in the file | |||
2478 | trace_buf_size=nn[KMG] | 2478 | trace_buf_size=nn[KMG] |
2479 | [FTRACE] will set tracing buffer size. | 2479 | [FTRACE] will set tracing buffer size. |
2480 | 2480 | ||
2481 | trace_event=[event-list] | ||
2482 | [FTRACE] Set and start specified trace events in order | ||
2483 | to facilitate early boot debugging. | ||
2484 | See also Documentation/trace/events.txt | ||
2485 | |||
2481 | trix= [HW,OSS] MediaTrix AudioTrix Pro | 2486 | trix= [HW,OSS] MediaTrix AudioTrix Pro |
2482 | Format: | 2487 | Format: |
2483 | <io>,<irq>,<dma>,<dma2>,<sb_io>,<sb_irq>,<sb_dma>,<mpu_io>,<mpu_irq> | 2488 | <io>,<irq>,<dma>,<dma2>,<sb_io>,<sb_irq>,<sb_dma>,<mpu_io>,<mpu_irq> |
diff --git a/Documentation/trace/events.txt b/Documentation/trace/events.txt index f157d7594ea7..2bcc8d4dea29 100644 --- a/Documentation/trace/events.txt +++ b/Documentation/trace/events.txt | |||
@@ -83,6 +83,15 @@ When reading one of these enable files, there are four results: | |||
83 | X - there is a mixture of events enabled and disabled | 83 | X - there is a mixture of events enabled and disabled |
84 | ? - this file does not affect any event | 84 | ? - this file does not affect any event |
85 | 85 | ||
86 | 2.3 Boot option | ||
87 | --------------- | ||
88 | |||
89 | In order to facilitate early boot debugging, use boot option: | ||
90 | |||
91 | trace_event=[event-list] | ||
92 | |||
93 | The format of this boot option is the same as described in section 2.1. | ||
94 | |||
86 | 3. Defining an event-enabled tracepoint | 95 | 3. Defining an event-enabled tracepoint |
87 | ======================================= | 96 | ======================================= |
88 | 97 | ||
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 3aa0a0dfdfa8..bdb3afc8b306 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -49,7 +49,7 @@ unsigned long __read_mostly tracing_thresh; | |||
49 | * On boot up, the ring buffer is set to the minimum size, so that | 49 | * On boot up, the ring buffer is set to the minimum size, so that |
50 | * we do not waste memory on systems that are not using tracing. | 50 | * we do not waste memory on systems that are not using tracing. |
51 | */ | 51 | */ |
52 | static int ring_buffer_expanded; | 52 | int ring_buffer_expanded; |
53 | 53 | ||
54 | /* | 54 | /* |
55 | * We need to change this state when a selftest is running. | 55 | * We need to change this state when a selftest is running. |
@@ -63,7 +63,7 @@ static bool __read_mostly tracing_selftest_running; | |||
63 | /* | 63 | /* |
64 | * If a tracer is running, we do not want to run SELFTEST. | 64 | * If a tracer is running, we do not want to run SELFTEST. |
65 | */ | 65 | */ |
66 | static bool __read_mostly tracing_selftest_disabled; | 66 | bool __read_mostly tracing_selftest_disabled; |
67 | 67 | ||
68 | /* For tracers that don't implement custom flags */ | 68 | /* For tracers that don't implement custom flags */ |
69 | static struct tracer_opt dummy_tracer_opt[] = { | 69 | static struct tracer_opt dummy_tracer_opt[] = { |
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 3548ae5cc780..52eb0d8dcd75 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -517,6 +517,9 @@ extern unsigned long ftrace_update_tot_cnt; | |||
517 | extern int DYN_FTRACE_TEST_NAME(void); | 517 | extern int DYN_FTRACE_TEST_NAME(void); |
518 | #endif | 518 | #endif |
519 | 519 | ||
520 | extern int ring_buffer_expanded; | ||
521 | extern bool tracing_selftest_disabled; | ||
522 | |||
520 | #ifdef CONFIG_FTRACE_STARTUP_TEST | 523 | #ifdef CONFIG_FTRACE_STARTUP_TEST |
521 | extern int trace_selftest_startup_function(struct tracer *trace, | 524 | extern int trace_selftest_startup_function(struct tracer *trace, |
522 | struct trace_array *tr); | 525 | struct trace_array *tr); |
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 53c8fd376a88..fecac1314cbe 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
@@ -17,6 +17,8 @@ | |||
17 | #include <linux/ctype.h> | 17 | #include <linux/ctype.h> |
18 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
19 | 19 | ||
20 | #include <asm/setup.h> | ||
21 | |||
20 | #include "trace_output.h" | 22 | #include "trace_output.h" |
21 | 23 | ||
22 | #define TRACE_SYSTEM "TRACE_SYSTEM" | 24 | #define TRACE_SYSTEM "TRACE_SYSTEM" |
@@ -1133,6 +1135,18 @@ struct notifier_block trace_module_nb = { | |||
1133 | extern struct ftrace_event_call __start_ftrace_events[]; | 1135 | extern struct ftrace_event_call __start_ftrace_events[]; |
1134 | extern struct ftrace_event_call __stop_ftrace_events[]; | 1136 | extern struct ftrace_event_call __stop_ftrace_events[]; |
1135 | 1137 | ||
1138 | static char bootup_event_buf[COMMAND_LINE_SIZE] __initdata; | ||
1139 | |||
1140 | static __init int setup_trace_event(char *str) | ||
1141 | { | ||
1142 | strlcpy(bootup_event_buf, str, COMMAND_LINE_SIZE); | ||
1143 | ring_buffer_expanded = 1; | ||
1144 | tracing_selftest_disabled = 1; | ||
1145 | |||
1146 | return 1; | ||
1147 | } | ||
1148 | __setup("trace_event=", setup_trace_event); | ||
1149 | |||
1136 | static __init int event_trace_init(void) | 1150 | static __init int event_trace_init(void) |
1137 | { | 1151 | { |
1138 | struct ftrace_event_call *call; | 1152 | struct ftrace_event_call *call; |
@@ -1140,6 +1154,8 @@ static __init int event_trace_init(void) | |||
1140 | struct dentry *entry; | 1154 | struct dentry *entry; |
1141 | struct dentry *d_events; | 1155 | struct dentry *d_events; |
1142 | int ret; | 1156 | int ret; |
1157 | char *buf = bootup_event_buf; | ||
1158 | char *token; | ||
1143 | 1159 | ||
1144 | d_tracer = tracing_init_dentry(); | 1160 | d_tracer = tracing_init_dentry(); |
1145 | if (!d_tracer) | 1161 | if (!d_tracer) |
@@ -1185,6 +1201,19 @@ static __init int event_trace_init(void) | |||
1185 | &ftrace_event_format_fops); | 1201 | &ftrace_event_format_fops); |
1186 | } | 1202 | } |
1187 | 1203 | ||
1204 | while (true) { | ||
1205 | token = strsep(&buf, ","); | ||
1206 | |||
1207 | if (!token) | ||
1208 | break; | ||
1209 | if (!*token) | ||
1210 | continue; | ||
1211 | |||
1212 | ret = ftrace_set_clr_event(token, 1); | ||
1213 | if (ret) | ||
1214 | pr_warning("Failed to enable trace event: %s\n", token); | ||
1215 | } | ||
1216 | |||
1188 | ret = register_module_notifier(&trace_module_nb); | 1217 | ret = register_module_notifier(&trace_module_nb); |
1189 | if (ret) | 1218 | if (ret) |
1190 | pr_warning("Failed to register trace events module notifier\n"); | 1219 | pr_warning("Failed to register trace events module notifier\n"); |
@@ -1392,10 +1421,10 @@ static __init void event_trace_self_test_with_function(void) | |||
1392 | 1421 | ||
1393 | static __init int event_trace_self_tests_init(void) | 1422 | static __init int event_trace_self_tests_init(void) |
1394 | { | 1423 | { |
1395 | 1424 | if (!tracing_selftest_disabled) { | |
1396 | event_trace_self_tests(); | 1425 | event_trace_self_tests(); |
1397 | 1426 | event_trace_self_test_with_function(); | |
1398 | event_trace_self_test_with_function(); | 1427 | } |
1399 | 1428 | ||
1400 | return 0; | 1429 | return 0; |
1401 | } | 1430 | } |