|
49 | 49 | #include <linux/irq_work.h>
|
50 | 50 | #include <linux/workqueue.h>
|
51 | 51 |
|
| 52 | +#include <asm/setup.h> /* COMMAND_LINE_SIZE */ |
| 53 | + |
52 | 54 | #include "trace.h"
|
53 | 55 | #include "trace_output.h"
|
54 | 56 |
|
@@ -186,6 +188,9 @@ static char *default_bootup_tracer;
|
186 | 188 | static bool allocate_snapshot;
|
187 | 189 | static bool snapshot_at_boot;
|
188 | 190 |
|
| 191 | +static char boot_instance_info[COMMAND_LINE_SIZE] __initdata; |
| 192 | +static int boot_instance_index; |
| 193 | + |
189 | 194 | static int __init set_cmdline_ftrace(char *str)
|
190 | 195 | {
|
191 | 196 | strlcpy(bootup_tracer_buf, str, MAX_TRACER_SIZE);
|
@@ -239,6 +244,23 @@ static int __init boot_snapshot(char *str)
|
239 | 244 | __setup("ftrace_boot_snapshot", boot_snapshot);
|
240 | 245 |
|
241 | 246 |
|
| 247 | +static int __init boot_instance(char *str) |
| 248 | +{ |
| 249 | + char *slot = boot_instance_info + boot_instance_index; |
| 250 | + int left = sizeof(boot_instance_info) - boot_instance_index; |
| 251 | + int ret; |
| 252 | + |
| 253 | + if (strlen(str) >= left) |
| 254 | + return -1; |
| 255 | + |
| 256 | + ret = snprintf(slot, left, "%s\t", str); |
| 257 | + boot_instance_index += ret; |
| 258 | + |
| 259 | + return 1; |
| 260 | +} |
| 261 | +__setup("trace_instance=", boot_instance); |
| 262 | + |
| 263 | + |
242 | 264 | static char trace_boot_options_buf[MAX_TRACER_SIZE] __initdata;
|
243 | 265 |
|
244 | 266 | static int __init set_trace_boot_options(char *str)
|
@@ -10144,6 +10166,31 @@ ssize_t trace_parse_run_command(struct file *file, const char __user *buffer,
|
10144 | 10166 | return ret;
|
10145 | 10167 | }
|
10146 | 10168 |
|
| 10169 | +__init static void enable_instances(void) |
| 10170 | +{ |
| 10171 | + struct trace_array *tr; |
| 10172 | + char *curr_str; |
| 10173 | + char *str; |
| 10174 | + char *tok; |
| 10175 | + |
| 10176 | + /* A tab is always appended */ |
| 10177 | + boot_instance_info[boot_instance_index - 1] = '\0'; |
| 10178 | + str = boot_instance_info; |
| 10179 | + |
| 10180 | + while ((curr_str = strsep(&str, "\t"))) { |
| 10181 | + |
| 10182 | + tok = strsep(&curr_str, ","); |
| 10183 | + |
| 10184 | + tr = trace_array_get_by_name(tok); |
| 10185 | + if (!tr) { |
| 10186 | + pr_warn("Failed to create instance buffer %s\n", curr_str); |
| 10187 | + continue; |
| 10188 | + } |
| 10189 | + /* Allow user space to delete it */ |
| 10190 | + trace_array_put(tr); |
| 10191 | + } |
| 10192 | +} |
| 10193 | + |
10147 | 10194 | __init static int tracer_alloc_buffers(void)
|
10148 | 10195 | {
|
10149 | 10196 | int ring_buf_size;
|
@@ -10302,6 +10349,9 @@ void __init early_trace_init(void)
|
10302 | 10349 | void __init trace_init(void)
|
10303 | 10350 | {
|
10304 | 10351 | trace_event_init();
|
| 10352 | + |
| 10353 | + if (boot_instance_index) |
| 10354 | + enable_instances(); |
10305 | 10355 | }
|
10306 | 10356 |
|
10307 | 10357 | __init static void clear_boot_tracer(void)
|
|
0 commit comments