aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/trace_events.h7
-rw-r--r--kernel/trace/trace.h6
-rw-r--r--kernel/trace/trace_events_trigger.c36
3 files changed, 27 insertions, 22 deletions
diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h
index 925730bc9fc1..0d6930e941e8 100644
--- a/include/linux/trace_events.h
+++ b/include/linux/trace_events.h
@@ -430,7 +430,8 @@ extern int call_filter_check_discard(struct trace_event_call *call, void *rec,
430extern enum event_trigger_type event_triggers_call(struct trace_event_file *file, 430extern enum event_trigger_type event_triggers_call(struct trace_event_file *file,
431 void *rec); 431 void *rec);
432extern void event_triggers_post_call(struct trace_event_file *file, 432extern void event_triggers_post_call(struct trace_event_file *file,
433 enum event_trigger_type tt); 433 enum event_trigger_type tt,
434 void *rec);
434 435
435bool trace_event_ignore_this_pid(struct trace_event_file *trace_file); 436bool trace_event_ignore_this_pid(struct trace_event_file *trace_file);
436 437
@@ -517,7 +518,7 @@ event_trigger_unlock_commit(struct trace_event_file *file,
517 trace_buffer_unlock_commit(file->tr, buffer, event, irq_flags, pc); 518 trace_buffer_unlock_commit(file->tr, buffer, event, irq_flags, pc);
518 519
519 if (tt) 520 if (tt)
520 event_triggers_post_call(file, tt); 521 event_triggers_post_call(file, tt, entry);
521} 522}
522 523
523/** 524/**
@@ -550,7 +551,7 @@ event_trigger_unlock_commit_regs(struct trace_event_file *file,
550 irq_flags, pc, regs); 551 irq_flags, pc, regs);
551 552
552 if (tt) 553 if (tt)
553 event_triggers_post_call(file, tt); 554 event_triggers_post_call(file, tt, entry);
554} 555}
555 556
556#ifdef CONFIG_BPF_EVENTS 557#ifdef CONFIG_BPF_EVENTS
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index b2bc956e2b0d..c10456e72106 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -1201,7 +1201,8 @@ extern int register_event_command(struct event_command *cmd);
1201 * @func: The trigger 'probe' function called when the triggering 1201 * @func: The trigger 'probe' function called when the triggering
1202 * event occurs. The data passed into this callback is the data 1202 * event occurs. The data passed into this callback is the data
1203 * that was supplied to the event_command @reg() function that 1203 * that was supplied to the event_command @reg() function that
1204 * registered the trigger (see struct event_command). 1204 * registered the trigger (see struct event_command) along with
1205 * the trace record, rec.
1205 * 1206 *
1206 * @init: An optional initialization function called for the trigger 1207 * @init: An optional initialization function called for the trigger
1207 * when the trigger is registered (via the event_command reg() 1208 * when the trigger is registered (via the event_command reg()
@@ -1226,7 +1227,8 @@ extern int register_event_command(struct event_command *cmd);
1226 * (see trace_event_triggers.c). 1227 * (see trace_event_triggers.c).
1227 */ 1228 */
1228struct event_trigger_ops { 1229struct event_trigger_ops {
1229 void (*func)(struct event_trigger_data *data); 1230 void (*func)(struct event_trigger_data *data,
1231 void *rec);
1230 int (*init)(struct event_trigger_ops *ops, 1232 int (*init)(struct event_trigger_ops *ops,
1231 struct event_trigger_data *data); 1233 struct event_trigger_data *data);
1232 void (*free)(struct event_trigger_ops *ops, 1234 void (*free)(struct event_trigger_ops *ops,
diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c
index f40424f35dcb..0a62887c63c0 100644
--- a/kernel/trace/trace_events_trigger.c
+++ b/kernel/trace/trace_events_trigger.c
@@ -73,7 +73,7 @@ event_triggers_call(struct trace_event_file *file, void *rec)
73 73
74 list_for_each_entry_rcu(data, &file->triggers, list) { 74 list_for_each_entry_rcu(data, &file->triggers, list) {
75 if (!rec) { 75 if (!rec) {
76 data->ops->func(data); 76 data->ops->func(data, rec);
77 continue; 77 continue;
78 } 78 }
79 filter = rcu_dereference_sched(data->filter); 79 filter = rcu_dereference_sched(data->filter);
@@ -83,7 +83,7 @@ event_triggers_call(struct trace_event_file *file, void *rec)
83 tt |= data->cmd_ops->trigger_type; 83 tt |= data->cmd_ops->trigger_type;
84 continue; 84 continue;
85 } 85 }
86 data->ops->func(data); 86 data->ops->func(data, rec);
87 } 87 }
88 return tt; 88 return tt;
89} 89}
@@ -93,6 +93,7 @@ EXPORT_SYMBOL_GPL(event_triggers_call);
93 * event_triggers_post_call - Call 'post_triggers' for a trace event 93 * event_triggers_post_call - Call 'post_triggers' for a trace event
94 * @file: The trace_event_file associated with the event 94 * @file: The trace_event_file associated with the event
95 * @tt: enum event_trigger_type containing a set bit for each trigger to invoke 95 * @tt: enum event_trigger_type containing a set bit for each trigger to invoke
96 * @rec: The trace entry for the event
96 * 97 *
97 * For each trigger associated with an event, invoke the trigger 98 * For each trigger associated with an event, invoke the trigger
98 * function registered with the associated trigger command, if the 99 * function registered with the associated trigger command, if the
@@ -103,13 +104,14 @@ EXPORT_SYMBOL_GPL(event_triggers_call);
103 */ 104 */
104void 105void
105event_triggers_post_call(struct trace_event_file *file, 106event_triggers_post_call(struct trace_event_file *file,
106 enum event_trigger_type tt) 107 enum event_trigger_type tt,
108 void *rec)
107{ 109{
108 struct event_trigger_data *data; 110 struct event_trigger_data *data;
109 111
110 list_for_each_entry_rcu(data, &file->triggers, list) { 112 list_for_each_entry_rcu(data, &file->triggers, list) {
111 if (data->cmd_ops->trigger_type & tt) 113 if (data->cmd_ops->trigger_type & tt)
112 data->ops->func(data); 114 data->ops->func(data, rec);
113 } 115 }
114} 116}
115EXPORT_SYMBOL_GPL(event_triggers_post_call); 117EXPORT_SYMBOL_GPL(event_triggers_post_call);
@@ -745,7 +747,7 @@ int set_trigger_filter(char *filter_str,
745} 747}
746 748
747static void 749static void
748traceon_trigger(struct event_trigger_data *data) 750traceon_trigger(struct event_trigger_data *data, void *rec)
749{ 751{
750 if (tracing_is_on()) 752 if (tracing_is_on())
751 return; 753 return;
@@ -754,7 +756,7 @@ traceon_trigger(struct event_trigger_data *data)
754} 756}
755 757
756static void 758static void
757traceon_count_trigger(struct event_trigger_data *data) 759traceon_count_trigger(struct event_trigger_data *data, void *rec)
758{ 760{
759 if (tracing_is_on()) 761 if (tracing_is_on())
760 return; 762 return;
@@ -769,7 +771,7 @@ traceon_count_trigger(struct event_trigger_data *data)
769} 771}
770 772
771static void 773static void
772traceoff_trigger(struct event_trigger_data *data) 774traceoff_trigger(struct event_trigger_data *data, void *rec)
773{ 775{
774 if (!tracing_is_on()) 776 if (!tracing_is_on())
775 return; 777 return;
@@ -778,7 +780,7 @@ traceoff_trigger(struct event_trigger_data *data)
778} 780}
779 781
780static void 782static void
781traceoff_count_trigger(struct event_trigger_data *data) 783traceoff_count_trigger(struct event_trigger_data *data, void *rec)
782{ 784{
783 if (!tracing_is_on()) 785 if (!tracing_is_on())
784 return; 786 return;
@@ -874,13 +876,13 @@ static struct event_command trigger_traceoff_cmd = {
874 876
875#ifdef CONFIG_TRACER_SNAPSHOT 877#ifdef CONFIG_TRACER_SNAPSHOT
876static void 878static void
877snapshot_trigger(struct event_trigger_data *data) 879snapshot_trigger(struct event_trigger_data *data, void *rec)
878{ 880{
879 tracing_snapshot(); 881 tracing_snapshot();
880} 882}
881 883
882static void 884static void
883snapshot_count_trigger(struct event_trigger_data *data) 885snapshot_count_trigger(struct event_trigger_data *data, void *rec)
884{ 886{
885 if (!data->count) 887 if (!data->count)
886 return; 888 return;
@@ -888,7 +890,7 @@ snapshot_count_trigger(struct event_trigger_data *data)
888 if (data->count != -1) 890 if (data->count != -1)
889 (data->count)--; 891 (data->count)--;
890 892
891 snapshot_trigger(data); 893 snapshot_trigger(data, rec);
892} 894}
893 895
894static int 896static int
@@ -967,13 +969,13 @@ static __init int register_trigger_snapshot_cmd(void) { return 0; }
967#define STACK_SKIP 3 969#define STACK_SKIP 3
968 970
969static void 971static void
970stacktrace_trigger(struct event_trigger_data *data) 972stacktrace_trigger(struct event_trigger_data *data, void *rec)
971{ 973{
972 trace_dump_stack(STACK_SKIP); 974 trace_dump_stack(STACK_SKIP);
973} 975}
974 976
975static void 977static void
976stacktrace_count_trigger(struct event_trigger_data *data) 978stacktrace_count_trigger(struct event_trigger_data *data, void *rec)
977{ 979{
978 if (!data->count) 980 if (!data->count)
979 return; 981 return;
@@ -981,7 +983,7 @@ stacktrace_count_trigger(struct event_trigger_data *data)
981 if (data->count != -1) 983 if (data->count != -1)
982 (data->count)--; 984 (data->count)--;
983 985
984 stacktrace_trigger(data); 986 stacktrace_trigger(data, rec);
985} 987}
986 988
987static int 989static int
@@ -1052,7 +1054,7 @@ struct enable_trigger_data {
1052}; 1054};
1053 1055
1054static void 1056static void
1055event_enable_trigger(struct event_trigger_data *data) 1057event_enable_trigger(struct event_trigger_data *data, void *rec)
1056{ 1058{
1057 struct enable_trigger_data *enable_data = data->private_data; 1059 struct enable_trigger_data *enable_data = data->private_data;
1058 1060
@@ -1063,7 +1065,7 @@ event_enable_trigger(struct event_trigger_data *data)
1063} 1065}
1064 1066
1065static void 1067static void
1066event_enable_count_trigger(struct event_trigger_data *data) 1068event_enable_count_trigger(struct event_trigger_data *data, void *rec)
1067{ 1069{
1068 struct enable_trigger_data *enable_data = data->private_data; 1070 struct enable_trigger_data *enable_data = data->private_data;
1069 1071
@@ -1077,7 +1079,7 @@ event_enable_count_trigger(struct event_trigger_data *data)
1077 if (data->count != -1) 1079 if (data->count != -1)
1078 (data->count)--; 1080 (data->count)--;
1079 1081
1080 event_enable_trigger(data); 1082 event_enable_trigger(data, rec);
1081} 1083}
1082 1084
1083static int 1085static int