diff options
-rw-r--r-- | kernel/trace/ftrace.c | 13 | ||||
-rw-r--r-- | kernel/trace/trace.c | 14 | ||||
-rw-r--r-- | kernel/trace/trace.h | 3 | ||||
-rw-r--r-- | kernel/trace/trace_events.c | 16 | ||||
-rw-r--r-- | kernel/trace/trace_functions.c | 35 |
5 files changed, 51 insertions, 30 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index ea208e93f000..e51cd6b51253 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -3791,6 +3791,7 @@ static void function_trace_probe_call(unsigned long ip, unsigned long parent_ip, | |||
3791 | struct ftrace_ops *op, struct pt_regs *pt_regs) | 3791 | struct ftrace_ops *op, struct pt_regs *pt_regs) |
3792 | { | 3792 | { |
3793 | struct ftrace_probe_ops *probe_ops; | 3793 | struct ftrace_probe_ops *probe_ops; |
3794 | struct trace_array *tr = op->private; | ||
3794 | 3795 | ||
3795 | probe_ops = container_of(op, struct ftrace_probe_ops, ops); | 3796 | probe_ops = container_of(op, struct ftrace_probe_ops, ops); |
3796 | 3797 | ||
@@ -3800,7 +3801,7 @@ static void function_trace_probe_call(unsigned long ip, unsigned long parent_ip, | |||
3800 | * on the hash. rcu_read_lock is too dangerous here. | 3801 | * on the hash. rcu_read_lock is too dangerous here. |
3801 | */ | 3802 | */ |
3802 | preempt_disable_notrace(); | 3803 | preempt_disable_notrace(); |
3803 | probe_ops->func(ip, parent_ip, probe_ops, NULL); | 3804 | probe_ops->func(ip, parent_ip, tr, probe_ops, NULL); |
3804 | preempt_enable_notrace(); | 3805 | preempt_enable_notrace(); |
3805 | } | 3806 | } |
3806 | 3807 | ||
@@ -3969,6 +3970,7 @@ register_ftrace_function_probe(char *glob, struct trace_array *tr, | |||
3969 | ops->ops.func = function_trace_probe_call; | 3970 | ops->ops.func = function_trace_probe_call; |
3970 | ftrace_ops_init(&ops->ops); | 3971 | ftrace_ops_init(&ops->ops); |
3971 | INIT_LIST_HEAD(&ops->list); | 3972 | INIT_LIST_HEAD(&ops->list); |
3973 | ops->ops.private = tr; | ||
3972 | } | 3974 | } |
3973 | 3975 | ||
3974 | mutex_lock(&ops->ops.func_hash->regex_lock); | 3976 | mutex_lock(&ops->ops.func_hash->regex_lock); |
@@ -3997,7 +3999,7 @@ register_ftrace_function_probe(char *glob, struct trace_array *tr, | |||
3997 | * to give the caller an opportunity to do so. | 3999 | * to give the caller an opportunity to do so. |
3998 | */ | 4000 | */ |
3999 | if (ops->init) { | 4001 | if (ops->init) { |
4000 | ret = ops->init(ops, entry->ip, data); | 4002 | ret = ops->init(ops, tr, entry->ip, data); |
4001 | if (ret < 0) | 4003 | if (ret < 0) |
4002 | goto out; | 4004 | goto out; |
4003 | } | 4005 | } |
@@ -4038,7 +4040,7 @@ register_ftrace_function_probe(char *glob, struct trace_array *tr, | |||
4038 | hlist_for_each_entry(entry, &hash->buckets[i], hlist) { | 4040 | hlist_for_each_entry(entry, &hash->buckets[i], hlist) { |
4039 | if (ftrace_lookup_ip(old_hash, entry->ip)) | 4041 | if (ftrace_lookup_ip(old_hash, entry->ip)) |
4040 | continue; | 4042 | continue; |
4041 | ops->free(ops, entry->ip, NULL); | 4043 | ops->free(ops, tr, entry->ip, NULL); |
4042 | } | 4044 | } |
4043 | } | 4045 | } |
4044 | goto out_unlock; | 4046 | goto out_unlock; |
@@ -4055,6 +4057,7 @@ unregister_ftrace_function_probe_func(char *glob, struct ftrace_probe_ops *ops) | |||
4055 | struct ftrace_hash *hash = NULL; | 4057 | struct ftrace_hash *hash = NULL; |
4056 | struct hlist_node *tmp; | 4058 | struct hlist_node *tmp; |
4057 | struct hlist_head hhd; | 4059 | struct hlist_head hhd; |
4060 | struct trace_array *tr; | ||
4058 | char str[KSYM_SYMBOL_LEN]; | 4061 | char str[KSYM_SYMBOL_LEN]; |
4059 | int i, ret; | 4062 | int i, ret; |
4060 | int size; | 4063 | int size; |
@@ -4062,6 +4065,8 @@ unregister_ftrace_function_probe_func(char *glob, struct ftrace_probe_ops *ops) | |||
4062 | if (!(ops->ops.flags & FTRACE_OPS_FL_INITIALIZED)) | 4065 | if (!(ops->ops.flags & FTRACE_OPS_FL_INITIALIZED)) |
4063 | return -EINVAL; | 4066 | return -EINVAL; |
4064 | 4067 | ||
4068 | tr = ops->ops.private; | ||
4069 | |||
4065 | if (glob && (strcmp(glob, "*") == 0 || !strlen(glob))) | 4070 | if (glob && (strcmp(glob, "*") == 0 || !strlen(glob))) |
4066 | func_g.search = NULL; | 4071 | func_g.search = NULL; |
4067 | else if (glob) { | 4072 | else if (glob) { |
@@ -4139,7 +4144,7 @@ unregister_ftrace_function_probe_func(char *glob, struct ftrace_probe_ops *ops) | |||
4139 | hlist_for_each_entry_safe(entry, tmp, &hhd, hlist) { | 4144 | hlist_for_each_entry_safe(entry, tmp, &hhd, hlist) { |
4140 | hlist_del(&entry->hlist); | 4145 | hlist_del(&entry->hlist); |
4141 | if (ops->free) | 4146 | if (ops->free) |
4142 | ops->free(ops, entry->ip, NULL); | 4147 | ops->free(ops, tr, entry->ip, NULL); |
4143 | kfree(entry); | 4148 | kfree(entry); |
4144 | } | 4149 | } |
4145 | mutex_unlock(&ftrace_lock); | 4150 | mutex_unlock(&ftrace_lock); |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 86598293787a..368310e78d45 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -6736,14 +6736,16 @@ static const struct file_operations tracing_dyn_info_fops = { | |||
6736 | #if defined(CONFIG_TRACER_SNAPSHOT) && defined(CONFIG_DYNAMIC_FTRACE) | 6736 | #if defined(CONFIG_TRACER_SNAPSHOT) && defined(CONFIG_DYNAMIC_FTRACE) |
6737 | static void | 6737 | static void |
6738 | ftrace_snapshot(unsigned long ip, unsigned long parent_ip, | 6738 | ftrace_snapshot(unsigned long ip, unsigned long parent_ip, |
6739 | struct ftrace_probe_ops *ops, void **data) | 6739 | struct trace_array *tr, struct ftrace_probe_ops *ops, |
6740 | void **data) | ||
6740 | { | 6741 | { |
6741 | tracing_snapshot(); | 6742 | tracing_snapshot(); |
6742 | } | 6743 | } |
6743 | 6744 | ||
6744 | static void | 6745 | static void |
6745 | ftrace_count_snapshot(unsigned long ip, unsigned long parent_ip, | 6746 | ftrace_count_snapshot(unsigned long ip, unsigned long parent_ip, |
6746 | struct ftrace_probe_ops *ops, void **data) | 6747 | struct trace_array *tr, struct ftrace_probe_ops *ops, |
6748 | void **data) | ||
6747 | { | 6749 | { |
6748 | struct ftrace_func_mapper *mapper = ops->private_data; | 6750 | struct ftrace_func_mapper *mapper = ops->private_data; |
6749 | long *count = NULL; | 6751 | long *count = NULL; |
@@ -6785,8 +6787,8 @@ ftrace_snapshot_print(struct seq_file *m, unsigned long ip, | |||
6785 | } | 6787 | } |
6786 | 6788 | ||
6787 | static int | 6789 | static int |
6788 | ftrace_snapshot_init(struct ftrace_probe_ops *ops, unsigned long ip, | 6790 | ftrace_snapshot_init(struct ftrace_probe_ops *ops, struct trace_array *tr, |
6789 | void *data) | 6791 | unsigned long ip, void *data) |
6790 | { | 6792 | { |
6791 | struct ftrace_func_mapper *mapper = ops->private_data; | 6793 | struct ftrace_func_mapper *mapper = ops->private_data; |
6792 | 6794 | ||
@@ -6794,8 +6796,8 @@ ftrace_snapshot_init(struct ftrace_probe_ops *ops, unsigned long ip, | |||
6794 | } | 6796 | } |
6795 | 6797 | ||
6796 | static void | 6798 | static void |
6797 | ftrace_snapshot_free(struct ftrace_probe_ops *ops, unsigned long ip, | 6799 | ftrace_snapshot_free(struct ftrace_probe_ops *ops, struct trace_array *tr, |
6798 | void **_data) | 6800 | unsigned long ip, void **data) |
6799 | { | 6801 | { |
6800 | struct ftrace_func_mapper *mapper = ops->private_data; | 6802 | struct ftrace_func_mapper *mapper = ops->private_data; |
6801 | 6803 | ||
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 68ff25e4cb19..390761804886 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -943,11 +943,14 @@ struct ftrace_probe_ops { | |||
943 | struct list_head list; | 943 | struct list_head list; |
944 | void (*func)(unsigned long ip, | 944 | void (*func)(unsigned long ip, |
945 | unsigned long parent_ip, | 945 | unsigned long parent_ip, |
946 | struct trace_array *tr, | ||
946 | struct ftrace_probe_ops *ops, | 947 | struct ftrace_probe_ops *ops, |
947 | void **data); | 948 | void **data); |
948 | int (*init)(struct ftrace_probe_ops *ops, | 949 | int (*init)(struct ftrace_probe_ops *ops, |
950 | struct trace_array *tr, | ||
949 | unsigned long ip, void *data); | 951 | unsigned long ip, void *data); |
950 | void (*free)(struct ftrace_probe_ops *ops, | 952 | void (*free)(struct ftrace_probe_ops *ops, |
953 | struct trace_array *tr, | ||
951 | unsigned long ip, void **data); | 954 | unsigned long ip, void **data); |
952 | int (*print)(struct seq_file *m, | 955 | int (*print)(struct seq_file *m, |
953 | unsigned long ip, | 956 | unsigned long ip, |
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index f0d6e5aef53e..713bec614312 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
@@ -2470,7 +2470,8 @@ static void update_event_probe(struct event_probe_data *data) | |||
2470 | 2470 | ||
2471 | static void | 2471 | static void |
2472 | event_enable_probe(unsigned long ip, unsigned long parent_ip, | 2472 | event_enable_probe(unsigned long ip, unsigned long parent_ip, |
2473 | struct ftrace_probe_ops *ops, void **_data) | 2473 | struct trace_array *tr, struct ftrace_probe_ops *ops, |
2474 | void **_data) | ||
2474 | { | 2475 | { |
2475 | struct ftrace_func_mapper *mapper = ops->private_data; | 2476 | struct ftrace_func_mapper *mapper = ops->private_data; |
2476 | struct event_probe_data *data; | 2477 | struct event_probe_data *data; |
@@ -2486,7 +2487,8 @@ event_enable_probe(unsigned long ip, unsigned long parent_ip, | |||
2486 | 2487 | ||
2487 | static void | 2488 | static void |
2488 | event_enable_count_probe(unsigned long ip, unsigned long parent_ip, | 2489 | event_enable_count_probe(unsigned long ip, unsigned long parent_ip, |
2489 | struct ftrace_probe_ops *ops, void **_data) | 2490 | struct trace_array *tr, struct ftrace_probe_ops *ops, |
2491 | void **_data) | ||
2490 | { | 2492 | { |
2491 | struct ftrace_func_mapper *mapper = ops->private_data; | 2493 | struct ftrace_func_mapper *mapper = ops->private_data; |
2492 | struct event_probe_data *data; | 2494 | struct event_probe_data *data; |
@@ -2513,7 +2515,7 @@ event_enable_count_probe(unsigned long ip, unsigned long parent_ip, | |||
2513 | 2515 | ||
2514 | static int | 2516 | static int |
2515 | event_enable_print(struct seq_file *m, unsigned long ip, | 2517 | event_enable_print(struct seq_file *m, unsigned long ip, |
2516 | struct ftrace_probe_ops *ops, void *_data) | 2518 | struct ftrace_probe_ops *ops, void *_data) |
2517 | { | 2519 | { |
2518 | struct ftrace_func_mapper *mapper = ops->private_data; | 2520 | struct ftrace_func_mapper *mapper = ops->private_data; |
2519 | struct event_probe_data *data; | 2521 | struct event_probe_data *data; |
@@ -2542,8 +2544,8 @@ event_enable_print(struct seq_file *m, unsigned long ip, | |||
2542 | } | 2544 | } |
2543 | 2545 | ||
2544 | static int | 2546 | static int |
2545 | event_enable_init(struct ftrace_probe_ops *ops, unsigned long ip, | 2547 | event_enable_init(struct ftrace_probe_ops *ops, struct trace_array *tr, |
2546 | void *_data) | 2548 | unsigned long ip, void *_data) |
2547 | { | 2549 | { |
2548 | struct ftrace_func_mapper *mapper = ops->private_data; | 2550 | struct ftrace_func_mapper *mapper = ops->private_data; |
2549 | struct event_probe_data *data = _data; | 2551 | struct event_probe_data *data = _data; |
@@ -2559,8 +2561,8 @@ event_enable_init(struct ftrace_probe_ops *ops, unsigned long ip, | |||
2559 | } | 2561 | } |
2560 | 2562 | ||
2561 | static void | 2563 | static void |
2562 | event_enable_free(struct ftrace_probe_ops *ops, unsigned long ip, | 2564 | event_enable_free(struct ftrace_probe_ops *ops, struct trace_array *tr, |
2563 | void **_data) | 2565 | unsigned long ip, void **_data) |
2564 | { | 2566 | { |
2565 | struct ftrace_func_mapper *mapper = ops->private_data; | 2567 | struct ftrace_func_mapper *mapper = ops->private_data; |
2566 | struct event_probe_data *data; | 2568 | struct event_probe_data *data; |
diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c index 2c8961b35401..797f087183c5 100644 --- a/kernel/trace/trace_functions.c +++ b/kernel/trace/trace_functions.c | |||
@@ -328,21 +328,24 @@ static void update_traceon_count(struct ftrace_probe_ops *ops, | |||
328 | 328 | ||
329 | static void | 329 | static void |
330 | ftrace_traceon_count(unsigned long ip, unsigned long parent_ip, | 330 | ftrace_traceon_count(unsigned long ip, unsigned long parent_ip, |
331 | struct ftrace_probe_ops *ops, void **data) | 331 | struct trace_array *tr, struct ftrace_probe_ops *ops, |
332 | void **data) | ||
332 | { | 333 | { |
333 | update_traceon_count(ops, ip, 1); | 334 | update_traceon_count(ops, ip, 1); |
334 | } | 335 | } |
335 | 336 | ||
336 | static void | 337 | static void |
337 | ftrace_traceoff_count(unsigned long ip, unsigned long parent_ip, | 338 | ftrace_traceoff_count(unsigned long ip, unsigned long parent_ip, |
338 | struct ftrace_probe_ops *ops, void **data) | 339 | struct trace_array *tr, struct ftrace_probe_ops *ops, |
340 | void **data) | ||
339 | { | 341 | { |
340 | update_traceon_count(ops, ip, 0); | 342 | update_traceon_count(ops, ip, 0); |
341 | } | 343 | } |
342 | 344 | ||
343 | static void | 345 | static void |
344 | ftrace_traceon(unsigned long ip, unsigned long parent_ip, | 346 | ftrace_traceon(unsigned long ip, unsigned long parent_ip, |
345 | struct ftrace_probe_ops *ops, void **data) | 347 | struct trace_array *tr, struct ftrace_probe_ops *ops, |
348 | void **data) | ||
346 | { | 349 | { |
347 | if (tracing_is_on()) | 350 | if (tracing_is_on()) |
348 | return; | 351 | return; |
@@ -352,7 +355,8 @@ ftrace_traceon(unsigned long ip, unsigned long parent_ip, | |||
352 | 355 | ||
353 | static void | 356 | static void |
354 | ftrace_traceoff(unsigned long ip, unsigned long parent_ip, | 357 | ftrace_traceoff(unsigned long ip, unsigned long parent_ip, |
355 | struct ftrace_probe_ops *ops, void **data) | 358 | struct trace_array *tr, struct ftrace_probe_ops *ops, |
359 | void **data) | ||
356 | { | 360 | { |
357 | if (!tracing_is_on()) | 361 | if (!tracing_is_on()) |
358 | return; | 362 | return; |
@@ -371,14 +375,16 @@ ftrace_traceoff(unsigned long ip, unsigned long parent_ip, | |||
371 | 375 | ||
372 | static void | 376 | static void |
373 | ftrace_stacktrace(unsigned long ip, unsigned long parent_ip, | 377 | ftrace_stacktrace(unsigned long ip, unsigned long parent_ip, |
374 | struct ftrace_probe_ops *ops, void **data) | 378 | struct trace_array *tr, struct ftrace_probe_ops *ops, |
379 | void **data) | ||
375 | { | 380 | { |
376 | trace_dump_stack(STACK_SKIP); | 381 | trace_dump_stack(STACK_SKIP); |
377 | } | 382 | } |
378 | 383 | ||
379 | static void | 384 | static void |
380 | ftrace_stacktrace_count(unsigned long ip, unsigned long parent_ip, | 385 | ftrace_stacktrace_count(unsigned long ip, unsigned long parent_ip, |
381 | struct ftrace_probe_ops *ops, void **data) | 386 | struct trace_array *tr, struct ftrace_probe_ops *ops, |
387 | void **data) | ||
382 | { | 388 | { |
383 | struct ftrace_func_mapper *mapper = ops->private_data; | 389 | struct ftrace_func_mapper *mapper = ops->private_data; |
384 | long *count; | 390 | long *count; |
@@ -436,7 +442,8 @@ static int update_count(struct ftrace_probe_ops *ops, unsigned long ip) | |||
436 | 442 | ||
437 | static void | 443 | static void |
438 | ftrace_dump_probe(unsigned long ip, unsigned long parent_ip, | 444 | ftrace_dump_probe(unsigned long ip, unsigned long parent_ip, |
439 | struct ftrace_probe_ops *ops, void **data) | 445 | struct trace_array *tr, struct ftrace_probe_ops *ops, |
446 | void **data) | ||
440 | { | 447 | { |
441 | if (update_count(ops, ip)) | 448 | if (update_count(ops, ip)) |
442 | ftrace_dump(DUMP_ALL); | 449 | ftrace_dump(DUMP_ALL); |
@@ -445,7 +452,8 @@ ftrace_dump_probe(unsigned long ip, unsigned long parent_ip, | |||
445 | /* Only dump the current CPU buffer. */ | 452 | /* Only dump the current CPU buffer. */ |
446 | static void | 453 | static void |
447 | ftrace_cpudump_probe(unsigned long ip, unsigned long parent_ip, | 454 | ftrace_cpudump_probe(unsigned long ip, unsigned long parent_ip, |
448 | struct ftrace_probe_ops *ops, void **data) | 455 | struct trace_array *tr, struct ftrace_probe_ops *ops, |
456 | void **data) | ||
449 | { | 457 | { |
450 | if (update_count(ops, ip)) | 458 | if (update_count(ops, ip)) |
451 | ftrace_dump(DUMP_ORIG); | 459 | ftrace_dump(DUMP_ORIG); |
@@ -473,7 +481,8 @@ ftrace_probe_print(const char *name, struct seq_file *m, | |||
473 | 481 | ||
474 | static int | 482 | static int |
475 | ftrace_traceon_print(struct seq_file *m, unsigned long ip, | 483 | ftrace_traceon_print(struct seq_file *m, unsigned long ip, |
476 | struct ftrace_probe_ops *ops, void *data) | 484 | struct ftrace_probe_ops *ops, |
485 | void *data) | ||
477 | { | 486 | { |
478 | return ftrace_probe_print("traceon", m, ip, ops); | 487 | return ftrace_probe_print("traceon", m, ip, ops); |
479 | } | 488 | } |
@@ -508,8 +517,8 @@ ftrace_cpudump_print(struct seq_file *m, unsigned long ip, | |||
508 | 517 | ||
509 | 518 | ||
510 | static int | 519 | static int |
511 | ftrace_count_init(struct ftrace_probe_ops *ops, unsigned long ip, | 520 | ftrace_count_init(struct ftrace_probe_ops *ops, struct trace_array *tr, |
512 | void *data) | 521 | unsigned long ip, void *data) |
513 | { | 522 | { |
514 | struct ftrace_func_mapper *mapper = ops->private_data; | 523 | struct ftrace_func_mapper *mapper = ops->private_data; |
515 | 524 | ||
@@ -517,8 +526,8 @@ ftrace_count_init(struct ftrace_probe_ops *ops, unsigned long ip, | |||
517 | } | 526 | } |
518 | 527 | ||
519 | static void | 528 | static void |
520 | ftrace_count_free(struct ftrace_probe_ops *ops, unsigned long ip, | 529 | ftrace_count_free(struct ftrace_probe_ops *ops, struct trace_array *tr, |
521 | void **_data) | 530 | unsigned long ip, void **_data) |
522 | { | 531 | { |
523 | struct ftrace_func_mapper *mapper = ops->private_data; | 532 | struct ftrace_func_mapper *mapper = ops->private_data; |
524 | 533 | ||