diff options
Diffstat (limited to 'kernel/trace/trace_events.c')
-rw-r--r-- | kernel/trace/trace_events.c | 55 |
1 files changed, 32 insertions, 23 deletions
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 83a4378dc5e0..3ddfd8f62c05 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
@@ -223,24 +223,25 @@ int ftrace_event_reg(struct ftrace_event_call *call, | |||
223 | { | 223 | { |
224 | struct ftrace_event_file *file = data; | 224 | struct ftrace_event_file *file = data; |
225 | 225 | ||
226 | WARN_ON(!(call->flags & TRACE_EVENT_FL_TRACEPOINT)); | ||
226 | switch (type) { | 227 | switch (type) { |
227 | case TRACE_REG_REGISTER: | 228 | case TRACE_REG_REGISTER: |
228 | return tracepoint_probe_register(call->name, | 229 | return tracepoint_probe_register(call->tp, |
229 | call->class->probe, | 230 | call->class->probe, |
230 | file); | 231 | file); |
231 | case TRACE_REG_UNREGISTER: | 232 | case TRACE_REG_UNREGISTER: |
232 | tracepoint_probe_unregister(call->name, | 233 | tracepoint_probe_unregister(call->tp, |
233 | call->class->probe, | 234 | call->class->probe, |
234 | file); | 235 | file); |
235 | return 0; | 236 | return 0; |
236 | 237 | ||
237 | #ifdef CONFIG_PERF_EVENTS | 238 | #ifdef CONFIG_PERF_EVENTS |
238 | case TRACE_REG_PERF_REGISTER: | 239 | case TRACE_REG_PERF_REGISTER: |
239 | return tracepoint_probe_register(call->name, | 240 | return tracepoint_probe_register(call->tp, |
240 | call->class->perf_probe, | 241 | call->class->perf_probe, |
241 | call); | 242 | call); |
242 | case TRACE_REG_PERF_UNREGISTER: | 243 | case TRACE_REG_PERF_UNREGISTER: |
243 | tracepoint_probe_unregister(call->name, | 244 | tracepoint_probe_unregister(call->tp, |
244 | call->class->perf_probe, | 245 | call->class->perf_probe, |
245 | call); | 246 | call); |
246 | return 0; | 247 | return 0; |
@@ -352,7 +353,7 @@ static int __ftrace_event_enable_disable(struct ftrace_event_file *file, | |||
352 | if (ret) { | 353 | if (ret) { |
353 | tracing_stop_cmdline_record(); | 354 | tracing_stop_cmdline_record(); |
354 | pr_info("event trace: Could not enable event " | 355 | pr_info("event trace: Could not enable event " |
355 | "%s\n", call->name); | 356 | "%s\n", ftrace_event_name(call)); |
356 | break; | 357 | break; |
357 | } | 358 | } |
358 | set_bit(FTRACE_EVENT_FL_ENABLED_BIT, &file->flags); | 359 | set_bit(FTRACE_EVENT_FL_ENABLED_BIT, &file->flags); |
@@ -481,27 +482,29 @@ __ftrace_set_clr_event_nolock(struct trace_array *tr, const char *match, | |||
481 | { | 482 | { |
482 | struct ftrace_event_file *file; | 483 | struct ftrace_event_file *file; |
483 | struct ftrace_event_call *call; | 484 | struct ftrace_event_call *call; |
485 | const char *name; | ||
484 | int ret = -EINVAL; | 486 | int ret = -EINVAL; |
485 | 487 | ||
486 | list_for_each_entry(file, &tr->events, list) { | 488 | list_for_each_entry(file, &tr->events, list) { |
487 | 489 | ||
488 | call = file->event_call; | 490 | call = file->event_call; |
491 | name = ftrace_event_name(call); | ||
489 | 492 | ||
490 | if (!call->name || !call->class || !call->class->reg) | 493 | if (!name || !call->class || !call->class->reg) |
491 | continue; | 494 | continue; |
492 | 495 | ||
493 | if (call->flags & TRACE_EVENT_FL_IGNORE_ENABLE) | 496 | if (call->flags & TRACE_EVENT_FL_IGNORE_ENABLE) |
494 | continue; | 497 | continue; |
495 | 498 | ||
496 | if (match && | 499 | if (match && |
497 | strcmp(match, call->name) != 0 && | 500 | strcmp(match, name) != 0 && |
498 | strcmp(match, call->class->system) != 0) | 501 | strcmp(match, call->class->system) != 0) |
499 | continue; | 502 | continue; |
500 | 503 | ||
501 | if (sub && strcmp(sub, call->class->system) != 0) | 504 | if (sub && strcmp(sub, call->class->system) != 0) |
502 | continue; | 505 | continue; |
503 | 506 | ||
504 | if (event && strcmp(event, call->name) != 0) | 507 | if (event && strcmp(event, name) != 0) |
505 | continue; | 508 | continue; |
506 | 509 | ||
507 | ftrace_event_enable_disable(file, set); | 510 | ftrace_event_enable_disable(file, set); |
@@ -699,7 +702,7 @@ static int t_show(struct seq_file *m, void *v) | |||
699 | 702 | ||
700 | if (strcmp(call->class->system, TRACE_SYSTEM) != 0) | 703 | if (strcmp(call->class->system, TRACE_SYSTEM) != 0) |
701 | seq_printf(m, "%s:", call->class->system); | 704 | seq_printf(m, "%s:", call->class->system); |
702 | seq_printf(m, "%s\n", call->name); | 705 | seq_printf(m, "%s\n", ftrace_event_name(call)); |
703 | 706 | ||
704 | return 0; | 707 | return 0; |
705 | } | 708 | } |
@@ -792,7 +795,7 @@ system_enable_read(struct file *filp, char __user *ubuf, size_t cnt, | |||
792 | mutex_lock(&event_mutex); | 795 | mutex_lock(&event_mutex); |
793 | list_for_each_entry(file, &tr->events, list) { | 796 | list_for_each_entry(file, &tr->events, list) { |
794 | call = file->event_call; | 797 | call = file->event_call; |
795 | if (!call->name || !call->class || !call->class->reg) | 798 | if (!ftrace_event_name(call) || !call->class || !call->class->reg) |
796 | continue; | 799 | continue; |
797 | 800 | ||
798 | if (system && strcmp(call->class->system, system->name) != 0) | 801 | if (system && strcmp(call->class->system, system->name) != 0) |
@@ -907,7 +910,7 @@ static int f_show(struct seq_file *m, void *v) | |||
907 | 910 | ||
908 | switch ((unsigned long)v) { | 911 | switch ((unsigned long)v) { |
909 | case FORMAT_HEADER: | 912 | case FORMAT_HEADER: |
910 | seq_printf(m, "name: %s\n", call->name); | 913 | seq_printf(m, "name: %s\n", ftrace_event_name(call)); |
911 | seq_printf(m, "ID: %d\n", call->event.type); | 914 | seq_printf(m, "ID: %d\n", call->event.type); |
912 | seq_printf(m, "format:\n"); | 915 | seq_printf(m, "format:\n"); |
913 | return 0; | 916 | return 0; |
@@ -1527,6 +1530,7 @@ event_create_dir(struct dentry *parent, struct ftrace_event_file *file) | |||
1527 | struct trace_array *tr = file->tr; | 1530 | struct trace_array *tr = file->tr; |
1528 | struct list_head *head; | 1531 | struct list_head *head; |
1529 | struct dentry *d_events; | 1532 | struct dentry *d_events; |
1533 | const char *name; | ||
1530 | int ret; | 1534 | int ret; |
1531 | 1535 | ||
1532 | /* | 1536 | /* |
@@ -1540,10 +1544,11 @@ event_create_dir(struct dentry *parent, struct ftrace_event_file *file) | |||
1540 | } else | 1544 | } else |
1541 | d_events = parent; | 1545 | d_events = parent; |
1542 | 1546 | ||
1543 | file->dir = debugfs_create_dir(call->name, d_events); | 1547 | name = ftrace_event_name(call); |
1548 | file->dir = debugfs_create_dir(name, d_events); | ||
1544 | if (!file->dir) { | 1549 | if (!file->dir) { |
1545 | pr_warning("Could not create debugfs '%s' directory\n", | 1550 | pr_warning("Could not create debugfs '%s' directory\n", |
1546 | call->name); | 1551 | name); |
1547 | return -1; | 1552 | return -1; |
1548 | } | 1553 | } |
1549 | 1554 | ||
@@ -1567,7 +1572,7 @@ event_create_dir(struct dentry *parent, struct ftrace_event_file *file) | |||
1567 | ret = call->class->define_fields(call); | 1572 | ret = call->class->define_fields(call); |
1568 | if (ret < 0) { | 1573 | if (ret < 0) { |
1569 | pr_warning("Could not initialize trace point" | 1574 | pr_warning("Could not initialize trace point" |
1570 | " events/%s\n", call->name); | 1575 | " events/%s\n", name); |
1571 | return -1; | 1576 | return -1; |
1572 | } | 1577 | } |
1573 | } | 1578 | } |
@@ -1631,15 +1636,17 @@ static void event_remove(struct ftrace_event_call *call) | |||
1631 | static int event_init(struct ftrace_event_call *call) | 1636 | static int event_init(struct ftrace_event_call *call) |
1632 | { | 1637 | { |
1633 | int ret = 0; | 1638 | int ret = 0; |
1639 | const char *name; | ||
1634 | 1640 | ||
1635 | if (WARN_ON(!call->name)) | 1641 | name = ftrace_event_name(call); |
1642 | if (WARN_ON(!name)) | ||
1636 | return -EINVAL; | 1643 | return -EINVAL; |
1637 | 1644 | ||
1638 | if (call->class->raw_init) { | 1645 | if (call->class->raw_init) { |
1639 | ret = call->class->raw_init(call); | 1646 | ret = call->class->raw_init(call); |
1640 | if (ret < 0 && ret != -ENOSYS) | 1647 | if (ret < 0 && ret != -ENOSYS) |
1641 | pr_warn("Could not initialize trace events/%s\n", | 1648 | pr_warn("Could not initialize trace events/%s\n", |
1642 | call->name); | 1649 | name); |
1643 | } | 1650 | } |
1644 | 1651 | ||
1645 | return ret; | 1652 | return ret; |
@@ -1885,7 +1892,7 @@ __trace_add_event_dirs(struct trace_array *tr) | |||
1885 | ret = __trace_add_new_event(call, tr); | 1892 | ret = __trace_add_new_event(call, tr); |
1886 | if (ret < 0) | 1893 | if (ret < 0) |
1887 | pr_warning("Could not create directory for event %s\n", | 1894 | pr_warning("Could not create directory for event %s\n", |
1888 | call->name); | 1895 | ftrace_event_name(call)); |
1889 | } | 1896 | } |
1890 | } | 1897 | } |
1891 | 1898 | ||
@@ -1894,18 +1901,20 @@ find_event_file(struct trace_array *tr, const char *system, const char *event) | |||
1894 | { | 1901 | { |
1895 | struct ftrace_event_file *file; | 1902 | struct ftrace_event_file *file; |
1896 | struct ftrace_event_call *call; | 1903 | struct ftrace_event_call *call; |
1904 | const char *name; | ||
1897 | 1905 | ||
1898 | list_for_each_entry(file, &tr->events, list) { | 1906 | list_for_each_entry(file, &tr->events, list) { |
1899 | 1907 | ||
1900 | call = file->event_call; | 1908 | call = file->event_call; |
1909 | name = ftrace_event_name(call); | ||
1901 | 1910 | ||
1902 | if (!call->name || !call->class || !call->class->reg) | 1911 | if (!name || !call->class || !call->class->reg) |
1903 | continue; | 1912 | continue; |
1904 | 1913 | ||
1905 | if (call->flags & TRACE_EVENT_FL_IGNORE_ENABLE) | 1914 | if (call->flags & TRACE_EVENT_FL_IGNORE_ENABLE) |
1906 | continue; | 1915 | continue; |
1907 | 1916 | ||
1908 | if (strcmp(event, call->name) == 0 && | 1917 | if (strcmp(event, name) == 0 && |
1909 | strcmp(system, call->class->system) == 0) | 1918 | strcmp(system, call->class->system) == 0) |
1910 | return file; | 1919 | return file; |
1911 | } | 1920 | } |
@@ -1973,7 +1982,7 @@ event_enable_print(struct seq_file *m, unsigned long ip, | |||
1973 | seq_printf(m, "%s:%s:%s", | 1982 | seq_printf(m, "%s:%s:%s", |
1974 | data->enable ? ENABLE_EVENT_STR : DISABLE_EVENT_STR, | 1983 | data->enable ? ENABLE_EVENT_STR : DISABLE_EVENT_STR, |
1975 | data->file->event_call->class->system, | 1984 | data->file->event_call->class->system, |
1976 | data->file->event_call->name); | 1985 | ftrace_event_name(data->file->event_call)); |
1977 | 1986 | ||
1978 | if (data->count == -1) | 1987 | if (data->count == -1) |
1979 | seq_printf(m, ":unlimited\n"); | 1988 | seq_printf(m, ":unlimited\n"); |
@@ -2193,7 +2202,7 @@ __trace_early_add_event_dirs(struct trace_array *tr) | |||
2193 | ret = event_create_dir(tr->event_dir, file); | 2202 | ret = event_create_dir(tr->event_dir, file); |
2194 | if (ret < 0) | 2203 | if (ret < 0) |
2195 | pr_warning("Could not create directory for event %s\n", | 2204 | pr_warning("Could not create directory for event %s\n", |
2196 | file->event_call->name); | 2205 | ftrace_event_name(file->event_call)); |
2197 | } | 2206 | } |
2198 | } | 2207 | } |
2199 | 2208 | ||
@@ -2217,7 +2226,7 @@ __trace_early_add_events(struct trace_array *tr) | |||
2217 | ret = __trace_early_add_new_event(call, tr); | 2226 | ret = __trace_early_add_new_event(call, tr); |
2218 | if (ret < 0) | 2227 | if (ret < 0) |
2219 | pr_warning("Could not create early event %s\n", | 2228 | pr_warning("Could not create early event %s\n", |
2220 | call->name); | 2229 | ftrace_event_name(call)); |
2221 | } | 2230 | } |
2222 | } | 2231 | } |
2223 | 2232 | ||
@@ -2549,7 +2558,7 @@ static __init void event_trace_self_tests(void) | |||
2549 | continue; | 2558 | continue; |
2550 | #endif | 2559 | #endif |
2551 | 2560 | ||
2552 | pr_info("Testing event %s: ", call->name); | 2561 | pr_info("Testing event %s: ", ftrace_event_name(call)); |
2553 | 2562 | ||
2554 | /* | 2563 | /* |
2555 | * If an event is already enabled, someone is using | 2564 | * If an event is already enabled, someone is using |