diff options
Diffstat (limited to 'kernel/trace/trace_events.c')
-rw-r--r-- | kernel/trace/trace_events.c | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 2f54b48d3632..19d1eb0a7188 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
@@ -127,13 +127,23 @@ static int ftrace_event_enable_disable(struct ftrace_event_call *call, | |||
127 | if (call->enabled) { | 127 | if (call->enabled) { |
128 | call->enabled = 0; | 128 | call->enabled = 0; |
129 | tracing_stop_cmdline_record(); | 129 | tracing_stop_cmdline_record(); |
130 | call->unregfunc(call); | 130 | if (call->class->reg) |
131 | call->class->reg(call, TRACE_REG_UNREGISTER); | ||
132 | else | ||
133 | tracepoint_probe_unregister(call->name, | ||
134 | call->class->probe, | ||
135 | call); | ||
131 | } | 136 | } |
132 | break; | 137 | break; |
133 | case 1: | 138 | case 1: |
134 | if (!call->enabled) { | 139 | if (!call->enabled) { |
135 | tracing_start_cmdline_record(); | 140 | tracing_start_cmdline_record(); |
136 | ret = call->regfunc(call); | 141 | if (call->class->reg) |
142 | ret = call->class->reg(call, TRACE_REG_REGISTER); | ||
143 | else | ||
144 | ret = tracepoint_probe_register(call->name, | ||
145 | call->class->probe, | ||
146 | call); | ||
137 | if (ret) { | 147 | if (ret) { |
138 | tracing_stop_cmdline_record(); | 148 | tracing_stop_cmdline_record(); |
139 | pr_info("event trace: Could not enable event " | 149 | pr_info("event trace: Could not enable event " |
@@ -171,7 +181,8 @@ static int __ftrace_set_clr_event(const char *match, const char *sub, | |||
171 | mutex_lock(&event_mutex); | 181 | mutex_lock(&event_mutex); |
172 | list_for_each_entry(call, &ftrace_events, list) { | 182 | list_for_each_entry(call, &ftrace_events, list) { |
173 | 183 | ||
174 | if (!call->name || !call->regfunc) | 184 | if (!call->name || !call->class || |
185 | (!call->class->probe && !call->class->reg)) | ||
175 | continue; | 186 | continue; |
176 | 187 | ||
177 | if (match && | 188 | if (match && |
@@ -297,7 +308,7 @@ t_next(struct seq_file *m, void *v, loff_t *pos) | |||
297 | * The ftrace subsystem is for showing formats only. | 308 | * The ftrace subsystem is for showing formats only. |
298 | * They can not be enabled or disabled via the event files. | 309 | * They can not be enabled or disabled via the event files. |
299 | */ | 310 | */ |
300 | if (call->regfunc) | 311 | if (call->class && (call->class->probe || call->class->reg)) |
301 | return call; | 312 | return call; |
302 | } | 313 | } |
303 | 314 | ||
@@ -450,7 +461,8 @@ system_enable_read(struct file *filp, char __user *ubuf, size_t cnt, | |||
450 | 461 | ||
451 | mutex_lock(&event_mutex); | 462 | mutex_lock(&event_mutex); |
452 | list_for_each_entry(call, &ftrace_events, list) { | 463 | list_for_each_entry(call, &ftrace_events, list) { |
453 | if (!call->name || !call->regfunc) | 464 | if (!call->name || !call->class || |
465 | (!call->class->probe && !call->class->reg)) | ||
454 | continue; | 466 | continue; |
455 | 467 | ||
456 | if (system && strcmp(call->class->system, system) != 0) | 468 | if (system && strcmp(call->class->system, system) != 0) |
@@ -935,13 +947,15 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events, | |||
935 | return -1; | 947 | return -1; |
936 | } | 948 | } |
937 | 949 | ||
938 | if (call->regfunc) | 950 | if (call->class->probe || call->class->reg) |
939 | trace_create_file("enable", 0644, call->dir, call, | 951 | trace_create_file("enable", 0644, call->dir, call, |
940 | enable); | 952 | enable); |
941 | 953 | ||
942 | if (call->id && call->perf_event_enable) | 954 | #ifdef CONFIG_PERF_EVENTS |
955 | if (call->id && (call->class->perf_probe || call->class->reg)) | ||
943 | trace_create_file("id", 0444, call->dir, call, | 956 | trace_create_file("id", 0444, call->dir, call, |
944 | id); | 957 | id); |
958 | #endif | ||
945 | 959 | ||
946 | if (call->define_fields) { | 960 | if (call->define_fields) { |
947 | ret = trace_define_common_fields(call); | 961 | ret = trace_define_common_fields(call); |
@@ -1388,8 +1402,8 @@ static __init void event_trace_self_tests(void) | |||
1388 | 1402 | ||
1389 | list_for_each_entry(call, &ftrace_events, list) { | 1403 | list_for_each_entry(call, &ftrace_events, list) { |
1390 | 1404 | ||
1391 | /* Only test those that have a regfunc */ | 1405 | /* Only test those that have a probe */ |
1392 | if (!call->regfunc) | 1406 | if (!call->class || !call->class->probe) |
1393 | continue; | 1407 | continue; |
1394 | 1408 | ||
1395 | /* | 1409 | /* |