Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752866AbcDOGyW (ORCPT ); Fri, 15 Apr 2016 02:54:22 -0400 Received: from mail-ig0-f172.google.com ([209.85.213.172]:37832 "EHLO mail-ig0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752139AbcDOGyU (ORCPT ); Fri, 15 Apr 2016 02:54:20 -0400 From: Howard Cochran To: linux-kernel@vger.kernel.org Cc: Steven Rostedt , Ingo Molnar , Howard Cochran , Howard Cochran Subject: [PATCH 1/5] tracing: Add param to event_trigger_ops.func() for instances Date: Fri, 15 Apr 2016 02:53:46 -0400 Message-Id: <1460703230-13307-2-git-send-email-hcochran@kernelspring.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1460703230-13307-1-git-send-email-hcochran@kernelspring.com> References: <1460703230-13307-1-git-send-email-hcochran@kernelspring.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5679 Lines: 178 (Non-functional change) Currently, the traceon, traceoff, stacktrace, and snapshot event triggers always affect the top level trace buffer, even when the trigger is enabled in a buffer instance. In order to fix this, the trigger's .func() needs to receive the struct trace_event_file * so that it can find the correct trace_array for the instance. This change adds the neeeded parameter and changes the declarations of each impementation to match. Changes to actually make use of the parameter will follow in subsequent commits. Signed-off-by: Howard Cochran --- kernel/trace/trace.h | 3 ++- kernel/trace/trace_events_trigger.c | 40 +++++++++++++++++++++++-------------- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 3fff4ad..ca4915f 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h @@ -1230,7 +1230,8 @@ extern int register_event_command(struct event_command *cmd); */ struct event_trigger_ops { void (*func)(struct event_trigger_data *data, - void *rec); + void *rec, + struct trace_event_file *file); int (*init)(struct event_trigger_ops *ops, struct event_trigger_data *data); void (*free)(struct event_trigger_ops *ops, diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c index d67992f..b69f2a2 100644 --- a/kernel/trace/trace_events_trigger.c +++ b/kernel/trace/trace_events_trigger.c @@ -75,7 +75,7 @@ event_triggers_call(struct trace_event_file *file, void *rec) if (data->paused) continue; if (!rec) { - data->ops->func(data, rec); + data->ops->func(data, rec, file); continue; } filter = rcu_dereference_sched(data->filter); @@ -85,7 +85,7 @@ event_triggers_call(struct trace_event_file *file, void *rec) tt |= data->cmd_ops->trigger_type; continue; } - data->ops->func(data, rec); + data->ops->func(data, rec, file); } return tt; } @@ -115,7 +115,7 @@ event_triggers_post_call(struct trace_event_file *file, if (data->paused) continue; if (data->cmd_ops->trigger_type & tt) - data->ops->func(data, rec); + data->ops->func(data, rec, file); } } EXPORT_SYMBOL_GPL(event_triggers_post_call); @@ -765,7 +765,8 @@ int set_trigger_filter(char *filter_str, } static void -traceon_trigger(struct event_trigger_data *data, void *rec) +traceon_trigger(struct event_trigger_data *data, void *rec, + struct trace_event_file *file) { if (tracing_is_on()) return; @@ -774,7 +775,8 @@ traceon_trigger(struct event_trigger_data *data, void *rec) } static void -traceon_count_trigger(struct event_trigger_data *data, void *rec) +traceon_count_trigger(struct event_trigger_data *data, void *rec, + struct trace_event_file *file) { if (tracing_is_on()) return; @@ -789,7 +791,8 @@ traceon_count_trigger(struct event_trigger_data *data, void *rec) } static void -traceoff_trigger(struct event_trigger_data *data, void *rec) +traceoff_trigger(struct event_trigger_data *data, void *rec, + struct trace_event_file *file) { if (!tracing_is_on()) return; @@ -798,7 +801,8 @@ traceoff_trigger(struct event_trigger_data *data, void *rec) } static void -traceoff_count_trigger(struct event_trigger_data *data, void *rec) +traceoff_count_trigger(struct event_trigger_data *data, void *rec, + struct trace_event_file *file) { if (!tracing_is_on()) return; @@ -894,13 +898,15 @@ static struct event_command trigger_traceoff_cmd = { #ifdef CONFIG_TRACER_SNAPSHOT static void -snapshot_trigger(struct event_trigger_data *data, void *rec) +snapshot_trigger(struct event_trigger_data *data, void *rec, + struct trace_event_file *file) { tracing_snapshot(); } static void -snapshot_count_trigger(struct event_trigger_data *data, void *rec) +snapshot_count_trigger(struct event_trigger_data *data, void *rec, + struct trace_event_file *file) { if (!data->count) return; @@ -987,13 +993,15 @@ static __init int register_trigger_snapshot_cmd(void) { return 0; } #define STACK_SKIP 3 static void -stacktrace_trigger(struct event_trigger_data *data, void *rec) +stacktrace_trigger(struct event_trigger_data *data, void *rec, + struct trace_event_file *file) { trace_dump_stack(STACK_SKIP); } static void -stacktrace_count_trigger(struct event_trigger_data *data, void *rec) +stacktrace_count_trigger(struct event_trigger_data *data, void *rec, + struct trace_event_file *file) { if (!data->count) return; @@ -1001,7 +1009,7 @@ stacktrace_count_trigger(struct event_trigger_data *data, void *rec) if (data->count != -1) (data->count)--; - stacktrace_trigger(data, rec); + stacktrace_trigger(data, rec, file); } static int @@ -1072,7 +1080,8 @@ struct enable_trigger_data { }; static void -event_enable_trigger(struct event_trigger_data *data, void *rec) +event_enable_trigger(struct event_trigger_data *data, void *rec, + struct trace_event_file *file) { struct enable_trigger_data *enable_data = data->private_data; @@ -1083,7 +1092,8 @@ event_enable_trigger(struct event_trigger_data *data, void *rec) } static void -event_enable_count_trigger(struct event_trigger_data *data, void *rec) +event_enable_count_trigger(struct event_trigger_data *data, void *rec, + struct trace_event_file *file) { struct enable_trigger_data *enable_data = data->private_data; @@ -1097,7 +1107,7 @@ event_enable_count_trigger(struct event_trigger_data *data, void *rec) if (data->count != -1) (data->count)--; - event_enable_trigger(data, rec); + event_enable_trigger(data, rec, file); } static int -- 1.9.1