diff options
author | Steven Rostedt (Red Hat) <rostedt@goodmis.org> | 2016-04-26 21:22:22 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2016-04-26 21:24:53 -0400 |
commit | dad56ee742a3abbb5d9e8108f8537d412bff3f57 (patch) | |
tree | 038d1dbc47cccdb6710ffafad02f10f37b50eadd | |
parent | 4afe6495e5cb3c352d95f07512cbb227e607e2ce (diff) |
tracing: Move event_trigger_unlock_commit{_regs}() to local header
The functions event_trigger_unlock_commit() and
event_trigger_unlock_commit_regs() are no longer used outside the tracing
system. Move them out of the generic headers and into the local one.
Along with __event_trigger_test_discard() that is only used by them.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r-- | include/linux/trace_events.h | 94 | ||||
-rw-r--r-- | kernel/trace/trace.h | 94 |
2 files changed, 94 insertions, 94 deletions
diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h index 5f89a5b0c7e6..70a181cb3585 100644 --- a/include/linux/trace_events.h +++ b/include/linux/trace_events.h | |||
@@ -452,100 +452,6 @@ trace_trigger_soft_disabled(struct trace_event_file *file) | |||
452 | return false; | 452 | return false; |
453 | } | 453 | } |
454 | 454 | ||
455 | /* | ||
456 | * Helper function for event_trigger_unlock_commit{_regs}(). | ||
457 | * If there are event triggers attached to this event that requires | ||
458 | * filtering against its fields, then they wil be called as the | ||
459 | * entry already holds the field information of the current event. | ||
460 | * | ||
461 | * It also checks if the event should be discarded or not. | ||
462 | * It is to be discarded if the event is soft disabled and the | ||
463 | * event was only recorded to process triggers, or if the event | ||
464 | * filter is active and this event did not match the filters. | ||
465 | * | ||
466 | * Returns true if the event is discarded, false otherwise. | ||
467 | */ | ||
468 | static inline bool | ||
469 | __event_trigger_test_discard(struct trace_event_file *file, | ||
470 | struct ring_buffer *buffer, | ||
471 | struct ring_buffer_event *event, | ||
472 | void *entry, | ||
473 | enum event_trigger_type *tt) | ||
474 | { | ||
475 | unsigned long eflags = file->flags; | ||
476 | |||
477 | if (eflags & EVENT_FILE_FL_TRIGGER_COND) | ||
478 | *tt = event_triggers_call(file, entry); | ||
479 | |||
480 | if (test_bit(EVENT_FILE_FL_SOFT_DISABLED_BIT, &file->flags)) | ||
481 | ring_buffer_discard_commit(buffer, event); | ||
482 | else if (!filter_check_discard(file, entry, buffer, event)) | ||
483 | return false; | ||
484 | |||
485 | return true; | ||
486 | } | ||
487 | |||
488 | /** | ||
489 | * event_trigger_unlock_commit - handle triggers and finish event commit | ||
490 | * @file: The file pointer assoctiated to the event | ||
491 | * @buffer: The ring buffer that the event is being written to | ||
492 | * @event: The event meta data in the ring buffer | ||
493 | * @entry: The event itself | ||
494 | * @irq_flags: The state of the interrupts at the start of the event | ||
495 | * @pc: The state of the preempt count at the start of the event. | ||
496 | * | ||
497 | * This is a helper function to handle triggers that require data | ||
498 | * from the event itself. It also tests the event against filters and | ||
499 | * if the event is soft disabled and should be discarded. | ||
500 | */ | ||
501 | static inline void | ||
502 | event_trigger_unlock_commit(struct trace_event_file *file, | ||
503 | struct ring_buffer *buffer, | ||
504 | struct ring_buffer_event *event, | ||
505 | void *entry, unsigned long irq_flags, int pc) | ||
506 | { | ||
507 | enum event_trigger_type tt = ETT_NONE; | ||
508 | |||
509 | if (!__event_trigger_test_discard(file, buffer, event, entry, &tt)) | ||
510 | trace_buffer_unlock_commit(file->tr, buffer, event, irq_flags, pc); | ||
511 | |||
512 | if (tt) | ||
513 | event_triggers_post_call(file, tt, entry); | ||
514 | } | ||
515 | |||
516 | /** | ||
517 | * event_trigger_unlock_commit_regs - handle triggers and finish event commit | ||
518 | * @file: The file pointer assoctiated to the event | ||
519 | * @buffer: The ring buffer that the event is being written to | ||
520 | * @event: The event meta data in the ring buffer | ||
521 | * @entry: The event itself | ||
522 | * @irq_flags: The state of the interrupts at the start of the event | ||
523 | * @pc: The state of the preempt count at the start of the event. | ||
524 | * | ||
525 | * This is a helper function to handle triggers that require data | ||
526 | * from the event itself. It also tests the event against filters and | ||
527 | * if the event is soft disabled and should be discarded. | ||
528 | * | ||
529 | * Same as event_trigger_unlock_commit() but calls | ||
530 | * trace_buffer_unlock_commit_regs() instead of trace_buffer_unlock_commit(). | ||
531 | */ | ||
532 | static inline void | ||
533 | event_trigger_unlock_commit_regs(struct trace_event_file *file, | ||
534 | struct ring_buffer *buffer, | ||
535 | struct ring_buffer_event *event, | ||
536 | void *entry, unsigned long irq_flags, int pc, | ||
537 | struct pt_regs *regs) | ||
538 | { | ||
539 | enum event_trigger_type tt = ETT_NONE; | ||
540 | |||
541 | if (!__event_trigger_test_discard(file, buffer, event, entry, &tt)) | ||
542 | trace_buffer_unlock_commit_regs(file->tr, buffer, event, | ||
543 | irq_flags, pc, regs); | ||
544 | |||
545 | if (tt) | ||
546 | event_triggers_post_call(file, tt, entry); | ||
547 | } | ||
548 | |||
549 | #ifdef CONFIG_BPF_EVENTS | 455 | #ifdef CONFIG_BPF_EVENTS |
550 | unsigned int trace_call_bpf(struct bpf_prog *prog, void *ctx); | 456 | unsigned int trace_call_bpf(struct bpf_prog *prog, void *ctx); |
551 | #else | 457 | #else |
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 727a3d28bce5..c0eac7b1e5a6 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -1065,6 +1065,100 @@ struct trace_subsystem_dir { | |||
1065 | int nr_events; | 1065 | int nr_events; |
1066 | }; | 1066 | }; |
1067 | 1067 | ||
1068 | /* | ||
1069 | * Helper function for event_trigger_unlock_commit{_regs}(). | ||
1070 | * If there are event triggers attached to this event that requires | ||
1071 | * filtering against its fields, then they wil be called as the | ||
1072 | * entry already holds the field information of the current event. | ||
1073 | * | ||
1074 | * It also checks if the event should be discarded or not. | ||
1075 | * It is to be discarded if the event is soft disabled and the | ||
1076 | * event was only recorded to process triggers, or if the event | ||
1077 | * filter is active and this event did not match the filters. | ||
1078 | * | ||
1079 | * Returns true if the event is discarded, false otherwise. | ||
1080 | */ | ||
1081 | static inline bool | ||
1082 | __event_trigger_test_discard(struct trace_event_file *file, | ||
1083 | struct ring_buffer *buffer, | ||
1084 | struct ring_buffer_event *event, | ||
1085 | void *entry, | ||
1086 | enum event_trigger_type *tt) | ||
1087 | { | ||
1088 | unsigned long eflags = file->flags; | ||
1089 | |||
1090 | if (eflags & EVENT_FILE_FL_TRIGGER_COND) | ||
1091 | *tt = event_triggers_call(file, entry); | ||
1092 | |||
1093 | if (test_bit(EVENT_FILE_FL_SOFT_DISABLED_BIT, &file->flags)) | ||
1094 | ring_buffer_discard_commit(buffer, event); | ||
1095 | else if (!filter_check_discard(file, entry, buffer, event)) | ||
1096 | return false; | ||
1097 | |||
1098 | return true; | ||
1099 | } | ||
1100 | |||
1101 | /** | ||
1102 | * event_trigger_unlock_commit - handle triggers and finish event commit | ||
1103 | * @file: The file pointer assoctiated to the event | ||
1104 | * @buffer: The ring buffer that the event is being written to | ||
1105 | * @event: The event meta data in the ring buffer | ||
1106 | * @entry: The event itself | ||
1107 | * @irq_flags: The state of the interrupts at the start of the event | ||
1108 | * @pc: The state of the preempt count at the start of the event. | ||
1109 | * | ||
1110 | * This is a helper function to handle triggers that require data | ||
1111 | * from the event itself. It also tests the event against filters and | ||
1112 | * if the event is soft disabled and should be discarded. | ||
1113 | */ | ||
1114 | static inline void | ||
1115 | event_trigger_unlock_commit(struct trace_event_file *file, | ||
1116 | struct ring_buffer *buffer, | ||
1117 | struct ring_buffer_event *event, | ||
1118 | void *entry, unsigned long irq_flags, int pc) | ||
1119 | { | ||
1120 | enum event_trigger_type tt = ETT_NONE; | ||
1121 | |||
1122 | if (!__event_trigger_test_discard(file, buffer, event, entry, &tt)) | ||
1123 | trace_buffer_unlock_commit(file->tr, buffer, event, irq_flags, pc); | ||
1124 | |||
1125 | if (tt) | ||
1126 | event_triggers_post_call(file, tt, entry); | ||
1127 | } | ||
1128 | |||
1129 | /** | ||
1130 | * event_trigger_unlock_commit_regs - handle triggers and finish event commit | ||
1131 | * @file: The file pointer assoctiated to the event | ||
1132 | * @buffer: The ring buffer that the event is being written to | ||
1133 | * @event: The event meta data in the ring buffer | ||
1134 | * @entry: The event itself | ||
1135 | * @irq_flags: The state of the interrupts at the start of the event | ||
1136 | * @pc: The state of the preempt count at the start of the event. | ||
1137 | * | ||
1138 | * This is a helper function to handle triggers that require data | ||
1139 | * from the event itself. It also tests the event against filters and | ||
1140 | * if the event is soft disabled and should be discarded. | ||
1141 | * | ||
1142 | * Same as event_trigger_unlock_commit() but calls | ||
1143 | * trace_buffer_unlock_commit_regs() instead of trace_buffer_unlock_commit(). | ||
1144 | */ | ||
1145 | static inline void | ||
1146 | event_trigger_unlock_commit_regs(struct trace_event_file *file, | ||
1147 | struct ring_buffer *buffer, | ||
1148 | struct ring_buffer_event *event, | ||
1149 | void *entry, unsigned long irq_flags, int pc, | ||
1150 | struct pt_regs *regs) | ||
1151 | { | ||
1152 | enum event_trigger_type tt = ETT_NONE; | ||
1153 | |||
1154 | if (!__event_trigger_test_discard(file, buffer, event, entry, &tt)) | ||
1155 | trace_buffer_unlock_commit_regs(file->tr, buffer, event, | ||
1156 | irq_flags, pc, regs); | ||
1157 | |||
1158 | if (tt) | ||
1159 | event_triggers_post_call(file, tt, entry); | ||
1160 | } | ||
1161 | |||
1068 | #define FILTER_PRED_INVALID ((unsigned short)-1) | 1162 | #define FILTER_PRED_INVALID ((unsigned short)-1) |
1069 | #define FILTER_PRED_IS_RIGHT (1 << 15) | 1163 | #define FILTER_PRED_IS_RIGHT (1 << 15) |
1070 | #define FILTER_PRED_FOLD (1 << 15) | 1164 | #define FILTER_PRED_FOLD (1 << 15) |