Received: by 10.223.164.202 with SMTP id h10csp688300wrb; Thu, 9 Nov 2017 12:44:14 -0800 (PST) X-Google-Smtp-Source: ABhQp+TWfXlFD1e1eKqQAshke7kci1d980WQmcNOECU37nVY1xazRvVD4r1H4Ajy7G8KpWSk7hvh X-Received: by 10.99.111.5 with SMTP id k5mr1683609pgc.364.1510260254572; Thu, 09 Nov 2017 12:44:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510260254; cv=none; d=google.com; s=arc-20160816; b=m7nUYfubIErnOpVtA+DgA0rEYrjD8iCwo4aaCuX3OpU7QdDOFWkGBxUsEn2OThGF+L w7BXQsUktnuyaHhoHXt/mcNLk+15mCT0JW75I7G1gmH5Z8GYkap1U58fS8VTojLbQilV kDHXm+bm6Xf90a8R4DnIMHl2Hs5PAj6b/07fo7dDv95NUWI12ghiO/InubW6X38nWliQ zVGsLE+A8TjVMXw8WM1daoKkpO8rAjEbs+ZU1hxI+C+5o/WfXekivJA2osjOT1vUcv3A PRfAGmSWflynognHc8bOd+5jGhclWrELWGvK+hGio++ThnIy1+FPtan3fALC4RxShJVJ KXYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=smUMQo5vyXvi+2py9MT6+gXLxeWw35VXab0Zy33I2m0=; b=Sx/wLXpZtzlmKVVudD3L2vYGiMNFsoRCqs5Q27nAJv1ekDoAFNJ4xATC7uGt1UyVYP Rp3nZ+Q92wfLlp8xW62AC3iygEnH3utEZ4VxFHeS8g7ITfqf69/kNSg6Ah4aYRCCAcW9 QjtT7716n9LcAEA2bVz3/SBHy14RtzGjEcKvuz4FviVPUVA7Supc0kyzERkiukp/ijOA A92OtjlJBYx/GCX/qf5S6b8W4QF1tpeKAYHG0cwitNJIHOXFSwvUkJtpR/e/27GFwkBH sieQQm/XDwvZSCUI+UKmUzorYpggne9+TDD08JNvbIWRnRntgryaw15auSSc96TNXujF +byw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f21si7453143pgv.505.2017.11.09.12.44.02; Thu, 09 Nov 2017 12:44:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754488AbdKIUeq (ORCPT + 83 others); Thu, 9 Nov 2017 15:34:46 -0500 Received: from mga14.intel.com ([192.55.52.115]:26664 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754354AbdKIUen (ORCPT ); Thu, 9 Nov 2017 15:34:43 -0500 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Nov 2017 12:34:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,370,1505804400"; d="scan'208";a="5891839" Received: from dkusalov-mobl4.amr.corp.intel.com (HELO localhost) ([10.254.117.34]) by orsmga002.jf.intel.com with ESMTP; 09 Nov 2017 12:34:40 -0800 From: Tom Zanussi To: rostedt@goodmis.org Cc: tglx@linutronix.de, mhiramat@kernel.org, namhyung@kernel.org, vedang.patel@intel.com, bigeasy@linutronix.de, joel.opensrc@gmail.com, joelaf@google.com, mathieu.desnoyers@efficios.com, baohong.liu@intel.com, rajvi.jingar@intel.com, julia@ni.com, linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org, Tom Zanussi Subject: [PATCH v5 08/37] tracing: Give event triggers access to ring_buffer_event Date: Thu, 9 Nov 2017 14:33:39 -0600 Message-Id: <6e473f3a38f6010e8b1ce605c7af2b412434d000.1510252666.git.tom.zanussi@linux.intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The ring_buffer event can provide a timestamp that may be useful to various triggers - pass it into the handlers for that purpose. Signed-off-by: Tom Zanussi --- include/linux/trace_events.h | 14 ++++++----- kernel/trace/trace.h | 9 +++---- kernel/trace/trace_events_hist.c | 11 +++++---- kernel/trace/trace_events_trigger.c | 47 +++++++++++++++++++++++-------------- 4 files changed, 49 insertions(+), 32 deletions(-) diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h index ca4e67e..2d1bb0f 100644 --- a/include/linux/trace_events.h +++ b/include/linux/trace_events.h @@ -406,11 +406,13 @@ enum event_trigger_type { extern int filter_match_preds(struct event_filter *filter, void *rec); -extern enum event_trigger_type event_triggers_call(struct trace_event_file *file, - void *rec); -extern void event_triggers_post_call(struct trace_event_file *file, - enum event_trigger_type tt, - void *rec); +extern enum event_trigger_type +event_triggers_call(struct trace_event_file *file, void *rec, + struct ring_buffer_event *event); +extern void +event_triggers_post_call(struct trace_event_file *file, + enum event_trigger_type tt, + void *rec, struct ring_buffer_event *event); bool trace_event_ignore_this_pid(struct trace_event_file *trace_file); @@ -430,7 +432,7 @@ extern void event_triggers_post_call(struct trace_event_file *file, if (!(eflags & EVENT_FILE_FL_TRIGGER_COND)) { if (eflags & EVENT_FILE_FL_TRIGGER_MODE) - event_triggers_call(file, NULL); + event_triggers_call(file, NULL, NULL); if (eflags & EVENT_FILE_FL_SOFT_DISABLED) return true; if (eflags & EVENT_FILE_FL_PID_FILTER) diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 4d8bde0..bbfb577 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h @@ -1293,7 +1293,7 @@ static inline void trace_buffer_unlock_commit(struct trace_array *tr, unsigned long eflags = file->flags; if (eflags & EVENT_FILE_FL_TRIGGER_COND) - *tt = event_triggers_call(file, entry); + *tt = event_triggers_call(file, entry, event); if (test_bit(EVENT_FILE_FL_SOFT_DISABLED_BIT, &file->flags) || (unlikely(file->flags & EVENT_FILE_FL_FILTERED) && @@ -1330,7 +1330,7 @@ static inline void trace_buffer_unlock_commit(struct trace_array *tr, trace_buffer_unlock_commit(file->tr, buffer, event, irq_flags, pc); if (tt) - event_triggers_post_call(file, tt, entry); + event_triggers_post_call(file, tt, entry, event); } /** @@ -1363,7 +1363,7 @@ static inline void trace_buffer_unlock_commit(struct trace_array *tr, irq_flags, pc, regs); if (tt) - event_triggers_post_call(file, tt, entry); + event_triggers_post_call(file, tt, entry, event); } #define FILTER_PRED_INVALID ((unsigned short)-1) @@ -1588,7 +1588,8 @@ extern void set_named_trigger_data(struct event_trigger_data *data, */ struct event_trigger_ops { void (*func)(struct event_trigger_data *data, - void *rec); + void *rec, + struct ring_buffer_event *rbe); 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_hist.c b/kernel/trace/trace_events_hist.c index 712260e..63a1912 100644 --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c @@ -909,7 +909,8 @@ static inline void add_to_key(char *compound_key, void *key, memcpy(compound_key + key_field->offset, key, size); } -static void event_hist_trigger(struct event_trigger_data *data, void *rec) +static void event_hist_trigger(struct event_trigger_data *data, void *rec, + struct ring_buffer_event *event) { struct hist_trigger_data *hist_data = data->private_data; bool use_compound_key = (hist_data->n_keys > 1); @@ -1658,7 +1659,8 @@ __init int register_trigger_hist_cmd(void) } static void -hist_enable_trigger(struct event_trigger_data *data, void *rec) +hist_enable_trigger(struct event_trigger_data *data, void *rec, + struct ring_buffer_event *event) { struct enable_trigger_data *enable_data = data->private_data; struct event_trigger_data *test; @@ -1674,7 +1676,8 @@ __init int register_trigger_hist_cmd(void) } static void -hist_enable_count_trigger(struct event_trigger_data *data, void *rec) +hist_enable_count_trigger(struct event_trigger_data *data, void *rec, + struct ring_buffer_event *event) { if (!data->count) return; @@ -1682,7 +1685,7 @@ __init int register_trigger_hist_cmd(void) if (data->count != -1) (data->count)--; - hist_enable_trigger(data, rec); + hist_enable_trigger(data, rec, event); } static struct event_trigger_ops hist_enable_trigger_ops = { diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c index f2ac9d4..9b0fe31 100644 --- a/kernel/trace/trace_events_trigger.c +++ b/kernel/trace/trace_events_trigger.c @@ -63,7 +63,8 @@ void trigger_data_free(struct event_trigger_data *data) * any trigger that should be deferred, ETT_NONE if nothing to defer. */ enum event_trigger_type -event_triggers_call(struct trace_event_file *file, void *rec) +event_triggers_call(struct trace_event_file *file, void *rec, + struct ring_buffer_event *event) { struct event_trigger_data *data; enum event_trigger_type tt = ETT_NONE; @@ -76,7 +77,7 @@ enum event_trigger_type if (data->paused) continue; if (!rec) { - data->ops->func(data, rec); + data->ops->func(data, rec, event); continue; } filter = rcu_dereference_sched(data->filter); @@ -86,7 +87,7 @@ enum event_trigger_type tt |= data->cmd_ops->trigger_type; continue; } - data->ops->func(data, rec); + data->ops->func(data, rec, event); } return tt; } @@ -108,7 +109,7 @@ enum event_trigger_type void event_triggers_post_call(struct trace_event_file *file, enum event_trigger_type tt, - void *rec) + void *rec, struct ring_buffer_event *event) { struct event_trigger_data *data; @@ -116,7 +117,7 @@ enum event_trigger_type if (data->paused) continue; if (data->cmd_ops->trigger_type & tt) - data->ops->func(data, rec); + data->ops->func(data, rec, event); } } EXPORT_SYMBOL_GPL(event_triggers_post_call); @@ -909,7 +910,8 @@ void set_named_trigger_data(struct event_trigger_data *data, } static void -traceon_trigger(struct event_trigger_data *data, void *rec) +traceon_trigger(struct event_trigger_data *data, void *rec, + struct ring_buffer_event *event) { if (tracing_is_on()) return; @@ -918,7 +920,8 @@ void set_named_trigger_data(struct event_trigger_data *data, } static void -traceon_count_trigger(struct event_trigger_data *data, void *rec) +traceon_count_trigger(struct event_trigger_data *data, void *rec, + struct ring_buffer_event *event) { if (tracing_is_on()) return; @@ -933,7 +936,8 @@ void set_named_trigger_data(struct event_trigger_data *data, } static void -traceoff_trigger(struct event_trigger_data *data, void *rec) +traceoff_trigger(struct event_trigger_data *data, void *rec, + struct ring_buffer_event *event) { if (!tracing_is_on()) return; @@ -942,7 +946,8 @@ void set_named_trigger_data(struct event_trigger_data *data, } static void -traceoff_count_trigger(struct event_trigger_data *data, void *rec) +traceoff_count_trigger(struct event_trigger_data *data, void *rec, + struct ring_buffer_event *event) { if (!tracing_is_on()) return; @@ -1039,13 +1044,15 @@ void set_named_trigger_data(struct event_trigger_data *data, #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 ring_buffer_event *event) { 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 ring_buffer_event *event) { if (!data->count) return; @@ -1053,7 +1060,7 @@ void set_named_trigger_data(struct event_trigger_data *data, if (data->count != -1) (data->count)--; - snapshot_trigger(data, rec); + snapshot_trigger(data, rec, event); } static int @@ -1132,13 +1139,15 @@ static __init int register_trigger_snapshot_cmd(void) #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 ring_buffer_event *event) { 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 ring_buffer_event *event) { if (!data->count) return; @@ -1146,7 +1155,7 @@ static __init int register_trigger_snapshot_cmd(void) if (data->count != -1) (data->count)--; - stacktrace_trigger(data, rec); + stacktrace_trigger(data, rec, event); } static int @@ -1208,7 +1217,8 @@ static __init void unregister_trigger_traceon_traceoff_cmds(void) } static void -event_enable_trigger(struct event_trigger_data *data, void *rec) +event_enable_trigger(struct event_trigger_data *data, void *rec, + struct ring_buffer_event *event) { struct enable_trigger_data *enable_data = data->private_data; @@ -1219,7 +1229,8 @@ static __init void unregister_trigger_traceon_traceoff_cmds(void) } 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 ring_buffer_event *event) { struct enable_trigger_data *enable_data = data->private_data; @@ -1233,7 +1244,7 @@ static __init void unregister_trigger_traceon_traceoff_cmds(void) if (data->count != -1) (data->count)--; - event_enable_trigger(data, rec); + event_enable_trigger(data, rec, event); } int event_enable_trigger_print(struct seq_file *m, -- 1.9.3 From 1583939252929875136@xxx Mon Nov 13 08:36:24 +0000 2017 X-GM-THRID: 1583939252929875136 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread