Skip to content

Commit b47e330

Browse files
committed
tracing: Pass buffer of event to trigger operations
The ring_buffer_event_time_stamp() is going to be updated to extract the time stamp for the event without needing it to be set to have absolute values for all events. But to do so, it needs the buffer that the event is on as the buffer saves information for the event before it is committed to the buffer. If the trace buffer is disabled, a temporary buffer is used, and there's no access to this buffer from the current histogram triggers, even though it is passed to the trace event code. Pass the buffer that the event is on all the way down to the histogram triggers. Link: https://lkml.kernel.org/r/20210316164113.542448131@goodmis.org Reviewed-by: Tom Zanussi <zanussi@kernel.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
1 parent 8672e49 commit b47e330

5 files changed

Lines changed: 95 additions & 53 deletions

File tree

‎include/linux/trace_events.h‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,8 @@ enum event_trigger_type {
640640
extern int filter_match_preds(struct event_filter *filter, void *rec);
641641

642642
extern enum event_trigger_type
643-
event_triggers_call(struct trace_event_file *file, void *rec,
643+
event_triggers_call(struct trace_event_file *file,
644+
struct trace_buffer *buffer, void *rec,
644645
struct ring_buffer_event *event);
645646
extern void
646647
event_triggers_post_call(struct trace_event_file *file,
@@ -664,7 +665,7 @@ trace_trigger_soft_disabled(struct trace_event_file *file)
664665

665666
if (!(eflags & EVENT_FILE_FL_TRIGGER_COND)) {
666667
if (eflags & EVENT_FILE_FL_TRIGGER_MODE)
667-
event_triggers_call(file, NULL, NULL);
668+
event_triggers_call(file, NULL, NULL, NULL);
668669
if (eflags & EVENT_FILE_FL_SOFT_DISABLED)
669670
return true;
670671
if (eflags & EVENT_FILE_FL_PID_FILTER)

‎kernel/trace/trace.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6763,7 +6763,7 @@ tracing_mark_write(struct file *filp, const char __user *ubuf,
67636763
if (tr->trace_marker_file && !list_empty(&tr->trace_marker_file->triggers)) {
67646764
/* do not add \n before testing triggers, but add \0 */
67656765
entry->buf[cnt] = '\0';
6766-
tt = event_triggers_call(tr->trace_marker_file, entry, event);
6766+
tt = event_triggers_call(tr->trace_marker_file, buffer, entry, event);
67676767
}
67686768

67696769
if (entry->buf[cnt - 1] != '\n') {

‎kernel/trace/trace.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,7 +1329,7 @@ __event_trigger_test_discard(struct trace_event_file *file,
13291329
unsigned long eflags = file->flags;
13301330

13311331
if (eflags & EVENT_FILE_FL_TRIGGER_COND)
1332-
*tt = event_triggers_call(file, entry, event);
1332+
*tt = event_triggers_call(file, buffer, entry, event);
13331333

13341334
if (test_bit(EVENT_FILE_FL_SOFT_DISABLED_BIT, &file->flags) ||
13351335
(unlikely(file->flags & EVENT_FILE_FL_FILTERED) &&
@@ -1626,7 +1626,7 @@ extern int register_trigger_hist_enable_disable_cmds(void);
16261626
*/
16271627
struct event_trigger_ops {
16281628
void (*func)(struct event_trigger_data *data,
1629-
void *rec,
1629+
struct trace_buffer *buffer, void *rec,
16301630
struct ring_buffer_event *rbe);
16311631
int (*init)(struct event_trigger_ops *ops,
16321632
struct event_trigger_data *data);

0 commit comments

Comments
 (0)