aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/trace/trace.c')
-rw-r--r--kernel/trace/trace.c47
1 files changed, 18 insertions, 29 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index a5e4c0af9bb0..1d4ff568cc4d 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -776,7 +776,7 @@ tracing_generic_entry_update(struct trace_entry *entry, unsigned long flags,
776} 776}
777 777
778void 778void
779trace_function(struct trace_array *tr, struct trace_array_cpu *data, 779trace_function(struct trace_array *tr,
780 unsigned long ip, unsigned long parent_ip, unsigned long flags, 780 unsigned long ip, unsigned long parent_ip, unsigned long flags,
781 int pc) 781 int pc)
782{ 782{
@@ -802,7 +802,6 @@ trace_function(struct trace_array *tr, struct trace_array_cpu *data,
802 802
803#ifdef CONFIG_FUNCTION_GRAPH_TRACER 803#ifdef CONFIG_FUNCTION_GRAPH_TRACER
804static void __trace_graph_entry(struct trace_array *tr, 804static void __trace_graph_entry(struct trace_array *tr,
805 struct trace_array_cpu *data,
806 struct ftrace_graph_ent *trace, 805 struct ftrace_graph_ent *trace,
807 unsigned long flags, 806 unsigned long flags,
808 int pc) 807 int pc)
@@ -826,7 +825,6 @@ static void __trace_graph_entry(struct trace_array *tr,
826} 825}
827 826
828static void __trace_graph_return(struct trace_array *tr, 827static void __trace_graph_return(struct trace_array *tr,
829 struct trace_array_cpu *data,
830 struct ftrace_graph_ret *trace, 828 struct ftrace_graph_ret *trace,
831 unsigned long flags, 829 unsigned long flags,
832 int pc) 830 int pc)
@@ -856,11 +854,10 @@ ftrace(struct trace_array *tr, struct trace_array_cpu *data,
856 int pc) 854 int pc)
857{ 855{
858 if (likely(!atomic_read(&data->disabled))) 856 if (likely(!atomic_read(&data->disabled)))
859 trace_function(tr, data, ip, parent_ip, flags, pc); 857 trace_function(tr, ip, parent_ip, flags, pc);
860} 858}
861 859
862static void __ftrace_trace_stack(struct trace_array *tr, 860static void __ftrace_trace_stack(struct trace_array *tr,
863 struct trace_array_cpu *data,
864 unsigned long flags, 861 unsigned long flags,
865 int skip, int pc) 862 int skip, int pc)
866{ 863{
@@ -891,27 +888,24 @@ static void __ftrace_trace_stack(struct trace_array *tr,
891} 888}
892 889
893static void ftrace_trace_stack(struct trace_array *tr, 890static void ftrace_trace_stack(struct trace_array *tr,
894 struct trace_array_cpu *data,
895 unsigned long flags, 891 unsigned long flags,
896 int skip, int pc) 892 int skip, int pc)
897{ 893{
898 if (!(trace_flags & TRACE_ITER_STACKTRACE)) 894 if (!(trace_flags & TRACE_ITER_STACKTRACE))
899 return; 895 return;
900 896
901 __ftrace_trace_stack(tr, data, flags, skip, pc); 897 __ftrace_trace_stack(tr, flags, skip, pc);
902} 898}
903 899
904void __trace_stack(struct trace_array *tr, 900void __trace_stack(struct trace_array *tr,
905 struct trace_array_cpu *data,
906 unsigned long flags, 901 unsigned long flags,
907 int skip, int pc) 902 int skip, int pc)
908{ 903{
909 __ftrace_trace_stack(tr, data, flags, skip, pc); 904 __ftrace_trace_stack(tr, flags, skip, pc);
910} 905}
911 906
912static void ftrace_trace_userstack(struct trace_array *tr, 907static void ftrace_trace_userstack(struct trace_array *tr,
913 struct trace_array_cpu *data, 908 unsigned long flags, int pc)
914 unsigned long flags, int pc)
915{ 909{
916#ifdef CONFIG_STACKTRACE 910#ifdef CONFIG_STACKTRACE
917 struct ring_buffer_event *event; 911 struct ring_buffer_event *event;
@@ -942,20 +936,17 @@ static void ftrace_trace_userstack(struct trace_array *tr,
942#endif 936#endif
943} 937}
944 938
945void __trace_userstack(struct trace_array *tr, 939void __trace_userstack(struct trace_array *tr, unsigned long flags)
946 struct trace_array_cpu *data,
947 unsigned long flags)
948{ 940{
949 ftrace_trace_userstack(tr, data, flags, preempt_count()); 941 ftrace_trace_userstack(tr, flags, preempt_count());
950} 942}
951 943
952static void 944static void
953ftrace_trace_special(void *__tr, void *__data, 945ftrace_trace_special(void *__tr,
954 unsigned long arg1, unsigned long arg2, unsigned long arg3, 946 unsigned long arg1, unsigned long arg2, unsigned long arg3,
955 int pc) 947 int pc)
956{ 948{
957 struct ring_buffer_event *event; 949 struct ring_buffer_event *event;
958 struct trace_array_cpu *data = __data;
959 struct trace_array *tr = __tr; 950 struct trace_array *tr = __tr;
960 struct special_entry *entry; 951 struct special_entry *entry;
961 unsigned long irq_flags; 952 unsigned long irq_flags;
@@ -971,8 +962,8 @@ ftrace_trace_special(void *__tr, void *__data,
971 entry->arg2 = arg2; 962 entry->arg2 = arg2;
972 entry->arg3 = arg3; 963 entry->arg3 = arg3;
973 ring_buffer_unlock_commit(tr->buffer, event, irq_flags); 964 ring_buffer_unlock_commit(tr->buffer, event, irq_flags);
974 ftrace_trace_stack(tr, data, irq_flags, 4, pc); 965 ftrace_trace_stack(tr, irq_flags, 4, pc);
975 ftrace_trace_userstack(tr, data, irq_flags, pc); 966 ftrace_trace_userstack(tr, irq_flags, pc);
976 967
977 trace_wake_up(); 968 trace_wake_up();
978} 969}
@@ -981,12 +972,11 @@ void
981__trace_special(void *__tr, void *__data, 972__trace_special(void *__tr, void *__data,
982 unsigned long arg1, unsigned long arg2, unsigned long arg3) 973 unsigned long arg1, unsigned long arg2, unsigned long arg3)
983{ 974{
984 ftrace_trace_special(__tr, __data, arg1, arg2, arg3, preempt_count()); 975 ftrace_trace_special(__tr, arg1, arg2, arg3, preempt_count());
985} 976}
986 977
987void 978void
988tracing_sched_switch_trace(struct trace_array *tr, 979tracing_sched_switch_trace(struct trace_array *tr,
989 struct trace_array_cpu *data,
990 struct task_struct *prev, 980 struct task_struct *prev,
991 struct task_struct *next, 981 struct task_struct *next,
992 unsigned long flags, int pc) 982 unsigned long flags, int pc)
@@ -1010,13 +1000,12 @@ tracing_sched_switch_trace(struct trace_array *tr,
1010 entry->next_state = next->state; 1000 entry->next_state = next->state;
1011 entry->next_cpu = task_cpu(next); 1001 entry->next_cpu = task_cpu(next);
1012 ring_buffer_unlock_commit(tr->buffer, event, irq_flags); 1002 ring_buffer_unlock_commit(tr->buffer, event, irq_flags);
1013 ftrace_trace_stack(tr, data, flags, 5, pc); 1003 ftrace_trace_stack(tr, flags, 5, pc);
1014 ftrace_trace_userstack(tr, data, flags, pc); 1004 ftrace_trace_userstack(tr, flags, pc);
1015} 1005}
1016 1006
1017void 1007void
1018tracing_sched_wakeup_trace(struct trace_array *tr, 1008tracing_sched_wakeup_trace(struct trace_array *tr,
1019 struct trace_array_cpu *data,
1020 struct task_struct *wakee, 1009 struct task_struct *wakee,
1021 struct task_struct *curr, 1010 struct task_struct *curr,
1022 unsigned long flags, int pc) 1011 unsigned long flags, int pc)
@@ -1040,8 +1029,8 @@ tracing_sched_wakeup_trace(struct trace_array *tr,
1040 entry->next_state = wakee->state; 1029 entry->next_state = wakee->state;
1041 entry->next_cpu = task_cpu(wakee); 1030 entry->next_cpu = task_cpu(wakee);
1042 ring_buffer_unlock_commit(tr->buffer, event, irq_flags); 1031 ring_buffer_unlock_commit(tr->buffer, event, irq_flags);
1043 ftrace_trace_stack(tr, data, flags, 6, pc); 1032 ftrace_trace_stack(tr, flags, 6, pc);
1044 ftrace_trace_userstack(tr, data, flags, pc); 1033 ftrace_trace_userstack(tr, flags, pc);
1045 1034
1046 trace_wake_up(); 1035 trace_wake_up();
1047} 1036}
@@ -1064,7 +1053,7 @@ ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3)
1064 data = tr->data[cpu]; 1053 data = tr->data[cpu];
1065 1054
1066 if (likely(atomic_inc_return(&data->disabled) == 1)) 1055 if (likely(atomic_inc_return(&data->disabled) == 1))
1067 ftrace_trace_special(tr, data, arg1, arg2, arg3, pc); 1056 ftrace_trace_special(tr, arg1, arg2, arg3, pc);
1068 1057
1069 atomic_dec(&data->disabled); 1058 atomic_dec(&data->disabled);
1070 local_irq_restore(flags); 1059 local_irq_restore(flags);
@@ -1092,7 +1081,7 @@ int trace_graph_entry(struct ftrace_graph_ent *trace)
1092 disabled = atomic_inc_return(&data->disabled); 1081 disabled = atomic_inc_return(&data->disabled);
1093 if (likely(disabled == 1)) { 1082 if (likely(disabled == 1)) {
1094 pc = preempt_count(); 1083 pc = preempt_count();
1095 __trace_graph_entry(tr, data, trace, flags, pc); 1084 __trace_graph_entry(tr, trace, flags, pc);
1096 } 1085 }
1097 /* Only do the atomic if it is not already set */ 1086 /* Only do the atomic if it is not already set */
1098 if (!test_tsk_trace_graph(current)) 1087 if (!test_tsk_trace_graph(current))
@@ -1118,7 +1107,7 @@ void trace_graph_return(struct ftrace_graph_ret *trace)
1118 disabled = atomic_inc_return(&data->disabled); 1107 disabled = atomic_inc_return(&data->disabled);
1119 if (likely(disabled == 1)) { 1108 if (likely(disabled == 1)) {
1120 pc = preempt_count(); 1109 pc = preempt_count();
1121 __trace_graph_return(tr, data, trace, flags, pc); 1110 __trace_graph_return(tr, trace, flags, pc);
1122 } 1111 }
1123 if (!trace->depth) 1112 if (!trace->depth)
1124 clear_tsk_trace_graph(current); 1113 clear_tsk_trace_graph(current);