diff options
Diffstat (limited to 'kernel/trace/trace_output.c')
-rw-r--r-- | kernel/trace/trace_output.c | 139 |
1 files changed, 62 insertions, 77 deletions
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c index a5752d4d3c33..c24503b281a0 100644 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c | |||
@@ -484,19 +484,18 @@ int unregister_ftrace_event(struct trace_event *event) | |||
484 | * Standard events | 484 | * Standard events |
485 | */ | 485 | */ |
486 | 486 | ||
487 | int | 487 | int trace_nop_print(struct trace_iterator *iter, int flags) |
488 | trace_nop_print(struct trace_seq *s, struct trace_entry *entry, int flags) | ||
489 | { | 488 | { |
490 | return 0; | 489 | return 0; |
491 | } | 490 | } |
492 | 491 | ||
493 | /* TRACE_FN */ | 492 | /* TRACE_FN */ |
494 | static int | 493 | static int trace_fn_latency(struct trace_iterator *iter, int flags) |
495 | trace_fn_latency(struct trace_seq *s, struct trace_entry *entry, int flags) | ||
496 | { | 494 | { |
497 | struct ftrace_entry *field; | 495 | struct ftrace_entry *field; |
496 | struct trace_seq *s = &iter->seq; | ||
498 | 497 | ||
499 | trace_assign_type(field, entry); | 498 | trace_assign_type(field, iter->ent); |
500 | 499 | ||
501 | if (!seq_print_ip_sym(s, field->ip, flags)) | 500 | if (!seq_print_ip_sym(s, field->ip, flags)) |
502 | goto partial; | 501 | goto partial; |
@@ -513,12 +512,12 @@ trace_fn_latency(struct trace_seq *s, struct trace_entry *entry, int flags) | |||
513 | return TRACE_TYPE_PARTIAL_LINE; | 512 | return TRACE_TYPE_PARTIAL_LINE; |
514 | } | 513 | } |
515 | 514 | ||
516 | static int | 515 | static int trace_fn_trace(struct trace_iterator *iter, int flags) |
517 | trace_fn_trace(struct trace_seq *s, struct trace_entry *entry, int flags) | ||
518 | { | 516 | { |
519 | struct ftrace_entry *field; | 517 | struct ftrace_entry *field; |
518 | struct trace_seq *s = &iter->seq; | ||
520 | 519 | ||
521 | trace_assign_type(field, entry); | 520 | trace_assign_type(field, iter->ent); |
522 | 521 | ||
523 | if (!seq_print_ip_sym(s, field->ip, flags)) | 522 | if (!seq_print_ip_sym(s, field->ip, flags)) |
524 | goto partial; | 523 | goto partial; |
@@ -540,14 +539,13 @@ trace_fn_trace(struct trace_seq *s, struct trace_entry *entry, int flags) | |||
540 | return TRACE_TYPE_PARTIAL_LINE; | 539 | return TRACE_TYPE_PARTIAL_LINE; |
541 | } | 540 | } |
542 | 541 | ||
543 | static int | 542 | static int trace_fn_raw(struct trace_iterator *iter, int flags) |
544 | trace_fn_raw(struct trace_seq *s, struct trace_entry *entry, int flags) | ||
545 | { | 543 | { |
546 | struct ftrace_entry *field; | 544 | struct ftrace_entry *field; |
547 | 545 | ||
548 | trace_assign_type(field, entry); | 546 | trace_assign_type(field, iter->ent); |
549 | 547 | ||
550 | if (!trace_seq_printf(s, "%lx %lx\n", | 548 | if (!trace_seq_printf(&iter->seq, "%lx %lx\n", |
551 | field->ip, | 549 | field->ip, |
552 | field->parent_ip)) | 550 | field->parent_ip)) |
553 | return TRACE_TYPE_PARTIAL_LINE; | 551 | return TRACE_TYPE_PARTIAL_LINE; |
@@ -555,12 +553,12 @@ trace_fn_raw(struct trace_seq *s, struct trace_entry *entry, int flags) | |||
555 | return 0; | 553 | return 0; |
556 | } | 554 | } |
557 | 555 | ||
558 | static int | 556 | static int trace_fn_hex(struct trace_iterator *iter, int flags) |
559 | trace_fn_hex(struct trace_seq *s, struct trace_entry *entry, int flags) | ||
560 | { | 557 | { |
561 | struct ftrace_entry *field; | 558 | struct ftrace_entry *field; |
559 | struct trace_seq *s = &iter->seq; | ||
562 | 560 | ||
563 | trace_assign_type(field, entry); | 561 | trace_assign_type(field, iter->ent); |
564 | 562 | ||
565 | SEQ_PUT_HEX_FIELD_RET(s, field->ip); | 563 | SEQ_PUT_HEX_FIELD_RET(s, field->ip); |
566 | SEQ_PUT_HEX_FIELD_RET(s, field->parent_ip); | 564 | SEQ_PUT_HEX_FIELD_RET(s, field->parent_ip); |
@@ -568,12 +566,12 @@ trace_fn_hex(struct trace_seq *s, struct trace_entry *entry, int flags) | |||
568 | return 0; | 566 | return 0; |
569 | } | 567 | } |
570 | 568 | ||
571 | static int | 569 | static int trace_fn_bin(struct trace_iterator *iter, int flags) |
572 | trace_fn_bin(struct trace_seq *s, struct trace_entry *entry, int flags) | ||
573 | { | 570 | { |
574 | struct ftrace_entry *field; | 571 | struct ftrace_entry *field; |
572 | struct trace_seq *s = &iter->seq; | ||
575 | 573 | ||
576 | trace_assign_type(field, entry); | 574 | trace_assign_type(field, iter->ent); |
577 | 575 | ||
578 | SEQ_PUT_FIELD_RET(s, field->ip); | 576 | SEQ_PUT_FIELD_RET(s, field->ip); |
579 | SEQ_PUT_FIELD_RET(s, field->parent_ip); | 577 | SEQ_PUT_FIELD_RET(s, field->parent_ip); |
@@ -591,20 +589,19 @@ static struct trace_event trace_fn_event = { | |||
591 | }; | 589 | }; |
592 | 590 | ||
593 | /* TRACE_CTX an TRACE_WAKE */ | 591 | /* TRACE_CTX an TRACE_WAKE */ |
594 | static int | 592 | static int trace_ctxwake_print(struct trace_iterator *iter, char *delim) |
595 | trace_ctxwake_print(struct trace_seq *s, struct trace_entry *entry, int flags, | ||
596 | char *delim) | ||
597 | { | 593 | { |
598 | struct ctx_switch_entry *field; | 594 | struct ctx_switch_entry *field; |
599 | char *comm; | 595 | char *comm; |
600 | int S, T; | 596 | int S, T; |
601 | 597 | ||
602 | trace_assign_type(field, entry); | 598 | trace_assign_type(field, iter->ent); |
603 | 599 | ||
604 | T = task_state_char(field->next_state); | 600 | T = task_state_char(field->next_state); |
605 | S = task_state_char(field->prev_state); | 601 | S = task_state_char(field->prev_state); |
606 | comm = trace_find_cmdline(field->next_pid); | 602 | comm = trace_find_cmdline(field->next_pid); |
607 | if (!trace_seq_printf(s, " %5d:%3d:%c %s [%03d] %5d:%3d:%c %s\n", | 603 | if (!trace_seq_printf(&iter->seq, |
604 | " %5d:%3d:%c %s [%03d] %5d:%3d:%c %s\n", | ||
608 | field->prev_pid, | 605 | field->prev_pid, |
609 | field->prev_prio, | 606 | field->prev_prio, |
610 | S, delim, | 607 | S, delim, |
@@ -617,31 +614,27 @@ trace_ctxwake_print(struct trace_seq *s, struct trace_entry *entry, int flags, | |||
617 | return 0; | 614 | return 0; |
618 | } | 615 | } |
619 | 616 | ||
620 | static int | 617 | static int trace_ctx_print(struct trace_iterator *iter, int flags) |
621 | trace_ctx_print(struct trace_seq *s, struct trace_entry *entry, int flags) | ||
622 | { | 618 | { |
623 | return trace_ctxwake_print(s, entry, flags, "==>"); | 619 | return trace_ctxwake_print(iter, "==>"); |
624 | } | 620 | } |
625 | 621 | ||
626 | static int | 622 | static int trace_wake_print(struct trace_iterator *iter, int flags) |
627 | trace_wake_print(struct trace_seq *s, struct trace_entry *entry, int flags) | ||
628 | { | 623 | { |
629 | return trace_ctxwake_print(s, entry, flags, " +"); | 624 | return trace_ctxwake_print(iter, " +"); |
630 | } | 625 | } |
631 | 626 | ||
632 | static int | 627 | static int trace_ctxwake_raw(struct trace_iterator *iter, char S) |
633 | trace_ctxwake_raw(struct trace_seq *s, struct trace_entry *entry, int flags, | ||
634 | char S) | ||
635 | { | 628 | { |
636 | struct ctx_switch_entry *field; | 629 | struct ctx_switch_entry *field; |
637 | int T; | 630 | int T; |
638 | 631 | ||
639 | trace_assign_type(field, entry); | 632 | trace_assign_type(field, iter->ent); |
640 | 633 | ||
641 | if (!S) | 634 | if (!S) |
642 | task_state_char(field->prev_state); | 635 | task_state_char(field->prev_state); |
643 | T = task_state_char(field->next_state); | 636 | T = task_state_char(field->next_state); |
644 | if (!trace_seq_printf(s, "%d %d %c %d %d %d %c\n", | 637 | if (!trace_seq_printf(&iter->seq, "%d %d %c %d %d %d %c\n", |
645 | field->prev_pid, | 638 | field->prev_pid, |
646 | field->prev_prio, | 639 | field->prev_prio, |
647 | S, | 640 | S, |
@@ -654,27 +647,24 @@ trace_ctxwake_raw(struct trace_seq *s, struct trace_entry *entry, int flags, | |||
654 | return 0; | 647 | return 0; |
655 | } | 648 | } |
656 | 649 | ||
657 | static int | 650 | static int trace_ctx_raw(struct trace_iterator *iter, int flags) |
658 | trace_ctx_raw(struct trace_seq *s, struct trace_entry *entry, int flags) | ||
659 | { | 651 | { |
660 | return trace_ctxwake_raw(s, entry, flags, 0); | 652 | return trace_ctxwake_raw(iter, 0); |
661 | } | 653 | } |
662 | 654 | ||
663 | static int | 655 | static int trace_wake_raw(struct trace_iterator *iter, int flags) |
664 | trace_wake_raw(struct trace_seq *s, struct trace_entry *entry, int flags) | ||
665 | { | 656 | { |
666 | return trace_ctxwake_raw(s, entry, flags, '+'); | 657 | return trace_ctxwake_raw(iter, '+'); |
667 | } | 658 | } |
668 | 659 | ||
669 | 660 | ||
670 | static int | 661 | static int trace_ctxwake_hex(struct trace_iterator *iter, char S) |
671 | trace_ctxwake_hex(struct trace_seq *s, struct trace_entry *entry, int flags, | ||
672 | char S) | ||
673 | { | 662 | { |
674 | struct ctx_switch_entry *field; | 663 | struct ctx_switch_entry *field; |
664 | struct trace_seq *s = &iter->seq; | ||
675 | int T; | 665 | int T; |
676 | 666 | ||
677 | trace_assign_type(field, entry); | 667 | trace_assign_type(field, iter->ent); |
678 | 668 | ||
679 | if (!S) | 669 | if (!S) |
680 | task_state_char(field->prev_state); | 670 | task_state_char(field->prev_state); |
@@ -691,24 +681,22 @@ trace_ctxwake_hex(struct trace_seq *s, struct trace_entry *entry, int flags, | |||
691 | return 0; | 681 | return 0; |
692 | } | 682 | } |
693 | 683 | ||
694 | static int | 684 | static int trace_ctx_hex(struct trace_iterator *iter, int flags) |
695 | trace_ctx_hex(struct trace_seq *s, struct trace_entry *entry, int flags) | ||
696 | { | 685 | { |
697 | return trace_ctxwake_hex(s, entry, flags, 0); | 686 | return trace_ctxwake_hex(iter, 0); |
698 | } | 687 | } |
699 | 688 | ||
700 | static int | 689 | static int trace_wake_hex(struct trace_iterator *iter, int flags) |
701 | trace_wake_hex(struct trace_seq *s, struct trace_entry *entry, int flags) | ||
702 | { | 690 | { |
703 | return trace_ctxwake_hex(s, entry, flags, '+'); | 691 | return trace_ctxwake_hex(iter, '+'); |
704 | } | 692 | } |
705 | 693 | ||
706 | static int | 694 | static int trace_ctxwake_bin(struct trace_iterator *iter, int flags) |
707 | trace_ctxwake_bin(struct trace_seq *s, struct trace_entry *entry, int flags) | ||
708 | { | 695 | { |
709 | struct ctx_switch_entry *field; | 696 | struct ctx_switch_entry *field; |
697 | struct trace_seq *s = &iter->seq; | ||
710 | 698 | ||
711 | trace_assign_type(field, entry); | 699 | trace_assign_type(field, iter->ent); |
712 | 700 | ||
713 | SEQ_PUT_FIELD_RET(s, field->prev_pid); | 701 | SEQ_PUT_FIELD_RET(s, field->prev_pid); |
714 | SEQ_PUT_FIELD_RET(s, field->prev_prio); | 702 | SEQ_PUT_FIELD_RET(s, field->prev_prio); |
@@ -739,14 +727,13 @@ static struct trace_event trace_wake_event = { | |||
739 | }; | 727 | }; |
740 | 728 | ||
741 | /* TRACE_SPECIAL */ | 729 | /* TRACE_SPECIAL */ |
742 | static int | 730 | static int trace_special_print(struct trace_iterator *iter, int flags) |
743 | trace_special_print(struct trace_seq *s, struct trace_entry *entry, int flags) | ||
744 | { | 731 | { |
745 | struct special_entry *field; | 732 | struct special_entry *field; |
746 | 733 | ||
747 | trace_assign_type(field, entry); | 734 | trace_assign_type(field, iter->ent); |
748 | 735 | ||
749 | if (!trace_seq_printf(s, "# %ld %ld %ld\n", | 736 | if (!trace_seq_printf(&iter->seq, "# %ld %ld %ld\n", |
750 | field->arg1, | 737 | field->arg1, |
751 | field->arg2, | 738 | field->arg2, |
752 | field->arg3)) | 739 | field->arg3)) |
@@ -755,12 +742,12 @@ trace_special_print(struct trace_seq *s, struct trace_entry *entry, int flags) | |||
755 | return 0; | 742 | return 0; |
756 | } | 743 | } |
757 | 744 | ||
758 | static int | 745 | static int trace_special_hex(struct trace_iterator *iter, int flags) |
759 | trace_special_hex(struct trace_seq *s, struct trace_entry *entry, int flags) | ||
760 | { | 746 | { |
761 | struct special_entry *field; | 747 | struct special_entry *field; |
748 | struct trace_seq *s = &iter->seq; | ||
762 | 749 | ||
763 | trace_assign_type(field, entry); | 750 | trace_assign_type(field, iter->ent); |
764 | 751 | ||
765 | SEQ_PUT_HEX_FIELD_RET(s, field->arg1); | 752 | SEQ_PUT_HEX_FIELD_RET(s, field->arg1); |
766 | SEQ_PUT_HEX_FIELD_RET(s, field->arg2); | 753 | SEQ_PUT_HEX_FIELD_RET(s, field->arg2); |
@@ -769,12 +756,12 @@ trace_special_hex(struct trace_seq *s, struct trace_entry *entry, int flags) | |||
769 | return 0; | 756 | return 0; |
770 | } | 757 | } |
771 | 758 | ||
772 | static int | 759 | static int trace_special_bin(struct trace_iterator *iter, int flags) |
773 | trace_special_bin(struct trace_seq *s, struct trace_entry *entry, int flags) | ||
774 | { | 760 | { |
775 | struct special_entry *field; | 761 | struct special_entry *field; |
762 | struct trace_seq *s = &iter->seq; | ||
776 | 763 | ||
777 | trace_assign_type(field, entry); | 764 | trace_assign_type(field, iter->ent); |
778 | 765 | ||
779 | SEQ_PUT_FIELD_RET(s, field->arg1); | 766 | SEQ_PUT_FIELD_RET(s, field->arg1); |
780 | SEQ_PUT_FIELD_RET(s, field->arg2); | 767 | SEQ_PUT_FIELD_RET(s, field->arg2); |
@@ -794,13 +781,13 @@ static struct trace_event trace_special_event = { | |||
794 | 781 | ||
795 | /* TRACE_STACK */ | 782 | /* TRACE_STACK */ |
796 | 783 | ||
797 | static int | 784 | static int trace_stack_print(struct trace_iterator *iter, int flags) |
798 | trace_stack_print(struct trace_seq *s, struct trace_entry *entry, int flags) | ||
799 | { | 785 | { |
800 | struct stack_entry *field; | 786 | struct stack_entry *field; |
787 | struct trace_seq *s = &iter->seq; | ||
801 | int i; | 788 | int i; |
802 | 789 | ||
803 | trace_assign_type(field, entry); | 790 | trace_assign_type(field, iter->ent); |
804 | 791 | ||
805 | for (i = 0; i < FTRACE_STACK_ENTRIES; i++) { | 792 | for (i = 0; i < FTRACE_STACK_ENTRIES; i++) { |
806 | if (i) { | 793 | if (i) { |
@@ -830,13 +817,12 @@ static struct trace_event trace_stack_event = { | |||
830 | }; | 817 | }; |
831 | 818 | ||
832 | /* TRACE_USER_STACK */ | 819 | /* TRACE_USER_STACK */ |
833 | static int | 820 | static int trace_user_stack_print(struct trace_iterator *iter, int flags) |
834 | trace_user_stack_print(struct trace_seq *s, struct trace_entry *entry, | ||
835 | int flags) | ||
836 | { | 821 | { |
837 | struct userstack_entry *field; | 822 | struct userstack_entry *field; |
823 | struct trace_seq *s = &iter->seq; | ||
838 | 824 | ||
839 | trace_assign_type(field, entry); | 825 | trace_assign_type(field, iter->ent); |
840 | 826 | ||
841 | if (!seq_print_userip_objs(field, s, flags)) | 827 | if (!seq_print_userip_objs(field, s, flags)) |
842 | goto partial; | 828 | goto partial; |
@@ -860,12 +846,12 @@ static struct trace_event trace_user_stack_event = { | |||
860 | }; | 846 | }; |
861 | 847 | ||
862 | /* TRACE_PRINT */ | 848 | /* TRACE_PRINT */ |
863 | static int | 849 | static int trace_print_print(struct trace_iterator *iter, int flags) |
864 | trace_print_print(struct trace_seq *s, struct trace_entry *entry, int flags) | ||
865 | { | 850 | { |
866 | struct print_entry *field; | 851 | struct print_entry *field; |
852 | struct trace_seq *s = &iter->seq; | ||
867 | 853 | ||
868 | trace_assign_type(field, entry); | 854 | trace_assign_type(field, iter->ent); |
869 | 855 | ||
870 | if (!seq_print_ip_sym(s, field->ip, flags)) | 856 | if (!seq_print_ip_sym(s, field->ip, flags)) |
871 | goto partial; | 857 | goto partial; |
@@ -879,14 +865,13 @@ trace_print_print(struct trace_seq *s, struct trace_entry *entry, int flags) | |||
879 | return TRACE_TYPE_PARTIAL_LINE; | 865 | return TRACE_TYPE_PARTIAL_LINE; |
880 | } | 866 | } |
881 | 867 | ||
882 | static int | 868 | static int trace_print_raw(struct trace_iterator *iter, int flags) |
883 | trace_print_raw(struct trace_seq *s, struct trace_entry *entry, int flags) | ||
884 | { | 869 | { |
885 | struct print_entry *field; | 870 | struct print_entry *field; |
886 | 871 | ||
887 | trace_assign_type(field, entry); | 872 | trace_assign_type(field, iter->ent); |
888 | 873 | ||
889 | if (!trace_seq_printf(s, "# %lx %s", field->ip, field->buf)) | 874 | if (!trace_seq_printf(&iter->seq, "# %lx %s", field->ip, field->buf)) |
890 | goto partial; | 875 | goto partial; |
891 | 876 | ||
892 | return 0; | 877 | return 0; |