diff options
Diffstat (limited to 'include/trace/ftrace.h')
-rw-r--r-- | include/trace/ftrace.h | 63 |
1 files changed, 10 insertions, 53 deletions
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h index d1b3de9c1a71..c6fe03e902ca 100644 --- a/include/trace/ftrace.h +++ b/include/trace/ftrace.h | |||
@@ -414,7 +414,8 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \ | |||
414 | BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ | 414 | BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ |
415 | ret = trace_define_field(event_call, #type "[" #len "]", #item, \ | 415 | ret = trace_define_field(event_call, #type "[" #len "]", #item, \ |
416 | offsetof(typeof(field), item), \ | 416 | offsetof(typeof(field), item), \ |
417 | sizeof(field.item), 0, FILTER_OTHER); \ | 417 | sizeof(field.item), \ |
418 | is_signed_type(type), FILTER_OTHER); \ | ||
418 | if (ret) \ | 419 | if (ret) \ |
419 | return ret; | 420 | return ret; |
420 | 421 | ||
@@ -422,8 +423,8 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \ | |||
422 | #define __dynamic_array(type, item, len) \ | 423 | #define __dynamic_array(type, item, len) \ |
423 | ret = trace_define_field(event_call, "__data_loc " #type "[]", #item, \ | 424 | ret = trace_define_field(event_call, "__data_loc " #type "[]", #item, \ |
424 | offsetof(typeof(field), __data_loc_##item), \ | 425 | offsetof(typeof(field), __data_loc_##item), \ |
425 | sizeof(field.__data_loc_##item), 0, \ | 426 | sizeof(field.__data_loc_##item), \ |
426 | FILTER_OTHER); | 427 | is_signed_type(type), FILTER_OTHER); |
427 | 428 | ||
428 | #undef __string | 429 | #undef __string |
429 | #define __string(item, src) __dynamic_array(char, item, -1) | 430 | #define __string(item, src) __dynamic_array(char, item, -1) |
@@ -436,10 +437,6 @@ ftrace_define_fields_##call(struct ftrace_event_call *event_call) \ | |||
436 | struct ftrace_raw_##call field; \ | 437 | struct ftrace_raw_##call field; \ |
437 | int ret; \ | 438 | int ret; \ |
438 | \ | 439 | \ |
439 | ret = trace_define_common_fields(event_call); \ | ||
440 | if (ret) \ | ||
441 | return ret; \ | ||
442 | \ | ||
443 | tstruct; \ | 440 | tstruct; \ |
444 | \ | 441 | \ |
445 | return ret; \ | 442 | return ret; \ |
@@ -559,13 +556,7 @@ static void ftrace_profile_disable_##name(struct ftrace_event_call *unused)\ | |||
559 | * | 556 | * |
560 | * static int ftrace_reg_event_<call>(struct ftrace_event_call *unused) | 557 | * static int ftrace_reg_event_<call>(struct ftrace_event_call *unused) |
561 | * { | 558 | * { |
562 | * int ret; | 559 | * return register_trace_<call>(ftrace_event_<call>); |
563 | * | ||
564 | * ret = register_trace_<call>(ftrace_event_<call>); | ||
565 | * if (!ret) | ||
566 | * pr_info("event trace: Could not activate trace point " | ||
567 | * "probe to <call>"); | ||
568 | * return ret; | ||
569 | * } | 560 | * } |
570 | * | 561 | * |
571 | * static void ftrace_unreg_event_<call>(struct ftrace_event_call *unused) | 562 | * static void ftrace_unreg_event_<call>(struct ftrace_event_call *unused) |
@@ -623,23 +614,12 @@ static void ftrace_profile_disable_##name(struct ftrace_event_call *unused)\ | |||
623 | * .trace = ftrace_raw_output_<call>, <-- stage 2 | 614 | * .trace = ftrace_raw_output_<call>, <-- stage 2 |
624 | * }; | 615 | * }; |
625 | * | 616 | * |
626 | * static int ftrace_raw_init_event_<call>(struct ftrace_event_call *unused) | ||
627 | * { | ||
628 | * int id; | ||
629 | * | ||
630 | * id = register_ftrace_event(&ftrace_event_type_<call>); | ||
631 | * if (!id) | ||
632 | * return -ENODEV; | ||
633 | * event_<call>.id = id; | ||
634 | * return 0; | ||
635 | * } | ||
636 | * | ||
637 | * static struct ftrace_event_call __used | 617 | * static struct ftrace_event_call __used |
638 | * __attribute__((__aligned__(4))) | 618 | * __attribute__((__aligned__(4))) |
639 | * __attribute__((section("_ftrace_events"))) event_<call> = { | 619 | * __attribute__((section("_ftrace_events"))) event_<call> = { |
640 | * .name = "<call>", | 620 | * .name = "<call>", |
641 | * .system = "<system>", | 621 | * .system = "<system>", |
642 | * .raw_init = ftrace_raw_init_event_<call>, | 622 | * .raw_init = trace_event_raw_init, |
643 | * .regfunc = ftrace_reg_event_<call>, | 623 | * .regfunc = ftrace_reg_event_<call>, |
644 | * .unregfunc = ftrace_unreg_event_<call>, | 624 | * .unregfunc = ftrace_unreg_event_<call>, |
645 | * .show_format = ftrace_format_<call>, | 625 | * .show_format = ftrace_format_<call>, |
@@ -647,13 +627,9 @@ static void ftrace_profile_disable_##name(struct ftrace_event_call *unused)\ | |||
647 | * | 627 | * |
648 | */ | 628 | */ |
649 | 629 | ||
650 | #undef TP_FMT | ||
651 | #define TP_FMT(fmt, args...) fmt "\n", ##args | ||
652 | |||
653 | #ifdef CONFIG_EVENT_PROFILE | 630 | #ifdef CONFIG_EVENT_PROFILE |
654 | 631 | ||
655 | #define _TRACE_PROFILE_INIT(call) \ | 632 | #define _TRACE_PROFILE_INIT(call) \ |
656 | .profile_count = ATOMIC_INIT(-1), \ | ||
657 | .profile_enable = ftrace_profile_enable_##call, \ | 633 | .profile_enable = ftrace_profile_enable_##call, \ |
658 | .profile_disable = ftrace_profile_disable_##call, | 634 | .profile_disable = ftrace_profile_disable_##call, |
659 | 635 | ||
@@ -728,13 +704,7 @@ static void ftrace_raw_event_##call(proto) \ | |||
728 | \ | 704 | \ |
729 | static int ftrace_raw_reg_event_##call(struct ftrace_event_call *unused)\ | 705 | static int ftrace_raw_reg_event_##call(struct ftrace_event_call *unused)\ |
730 | { \ | 706 | { \ |
731 | int ret; \ | 707 | return register_trace_##call(ftrace_raw_event_##call); \ |
732 | \ | ||
733 | ret = register_trace_##call(ftrace_raw_event_##call); \ | ||
734 | if (ret) \ | ||
735 | pr_info("event trace: Could not activate trace point " \ | ||
736 | "probe to " #call "\n"); \ | ||
737 | return ret; \ | ||
738 | } \ | 708 | } \ |
739 | \ | 709 | \ |
740 | static void ftrace_raw_unreg_event_##call(struct ftrace_event_call *unused)\ | 710 | static void ftrace_raw_unreg_event_##call(struct ftrace_event_call *unused)\ |
@@ -744,19 +714,7 @@ static void ftrace_raw_unreg_event_##call(struct ftrace_event_call *unused)\ | |||
744 | \ | 714 | \ |
745 | static struct trace_event ftrace_event_type_##call = { \ | 715 | static struct trace_event ftrace_event_type_##call = { \ |
746 | .trace = ftrace_raw_output_##call, \ | 716 | .trace = ftrace_raw_output_##call, \ |
747 | }; \ | 717 | }; |
748 | \ | ||
749 | static int ftrace_raw_init_event_##call(struct ftrace_event_call *unused)\ | ||
750 | { \ | ||
751 | int id; \ | ||
752 | \ | ||
753 | id = register_ftrace_event(&ftrace_event_type_##call); \ | ||
754 | if (!id) \ | ||
755 | return -ENODEV; \ | ||
756 | event_##call.id = id; \ | ||
757 | INIT_LIST_HEAD(&event_##call.fields); \ | ||
758 | return 0; \ | ||
759 | } | ||
760 | 718 | ||
761 | #undef DEFINE_EVENT_PRINT | 719 | #undef DEFINE_EVENT_PRINT |
762 | #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ | 720 | #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ |
@@ -776,7 +734,7 @@ __attribute__((section("_ftrace_events"))) event_##call = { \ | |||
776 | .name = #call, \ | 734 | .name = #call, \ |
777 | .system = __stringify(TRACE_SYSTEM), \ | 735 | .system = __stringify(TRACE_SYSTEM), \ |
778 | .event = &ftrace_event_type_##call, \ | 736 | .event = &ftrace_event_type_##call, \ |
779 | .raw_init = ftrace_raw_init_event_##call, \ | 737 | .raw_init = trace_event_raw_init, \ |
780 | .regfunc = ftrace_raw_reg_event_##call, \ | 738 | .regfunc = ftrace_raw_reg_event_##call, \ |
781 | .unregfunc = ftrace_raw_unreg_event_##call, \ | 739 | .unregfunc = ftrace_raw_unreg_event_##call, \ |
782 | .show_format = ftrace_format_##template, \ | 740 | .show_format = ftrace_format_##template, \ |
@@ -793,7 +751,7 @@ __attribute__((section("_ftrace_events"))) event_##call = { \ | |||
793 | .name = #call, \ | 751 | .name = #call, \ |
794 | .system = __stringify(TRACE_SYSTEM), \ | 752 | .system = __stringify(TRACE_SYSTEM), \ |
795 | .event = &ftrace_event_type_##call, \ | 753 | .event = &ftrace_event_type_##call, \ |
796 | .raw_init = ftrace_raw_init_event_##call, \ | 754 | .raw_init = trace_event_raw_init, \ |
797 | .regfunc = ftrace_raw_reg_event_##call, \ | 755 | .regfunc = ftrace_raw_reg_event_##call, \ |
798 | .unregfunc = ftrace_raw_unreg_event_##call, \ | 756 | .unregfunc = ftrace_raw_unreg_event_##call, \ |
799 | .show_format = ftrace_format_##call, \ | 757 | .show_format = ftrace_format_##call, \ |
@@ -953,7 +911,6 @@ end: \ | |||
953 | perf_swevent_put_recursion_context(rctx); \ | 911 | perf_swevent_put_recursion_context(rctx); \ |
954 | end_recursion: \ | 912 | end_recursion: \ |
955 | local_irq_restore(irq_flags); \ | 913 | local_irq_restore(irq_flags); \ |
956 | \ | ||
957 | } | 914 | } |
958 | 915 | ||
959 | #undef DEFINE_EVENT | 916 | #undef DEFINE_EVENT |