[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1434438373-32226-3-git-send-email-zhang.chunyan@linaro.org>
Date: Tue, 16 Jun 2015 15:06:12 +0800
From: Chunyan Zhang <zhang.chunyan@...aro.org>
To: rostedt@...dmis.org, mingo@...hat.com
Cc: mathieu.poirier@...aro.org, serge.broslavsky@...aro.org,
broonie@...aro.org, alexander.shishkin@...ux.intel.com,
zhang.lyra@...il.com, linux-kernel@...r.kernel.org
Subject: [RFC PATCH v2 2/3] Trace log handler for logging into STM blocks
Adding the function 'trace_event_stm_output_##call' for printing events
trace log into STM blocks.
This patch also added a function call at where the events have been
committed to ring buffer to export the trace event information to
STM blocks.
Signed-off-by: Chunyan Zhang <zhang.chunyan@...aro.org>
---
include/linux/ftrace_event.h | 15 ++++++++++++++
include/trace/ftrace.h | 47 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+)
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 46e83c2..f0c7426 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -14,6 +14,7 @@ struct trace_buffer;
struct tracer;
struct dentry;
struct bpf_prog;
+struct trace_buffer_stm;
struct trace_print_flags {
unsigned long mask;
@@ -304,6 +305,9 @@ struct ftrace_event_call {
*/
int flags; /* static flags of different events */
+ void (*output_stm)(struct trace_seq *tmp_seq, void *entry,
+ struct trace_buffer_stm *tb);
+
#ifdef CONFIG_PERF_EVENTS
int perf_refcount;
struct hlist_head __percpu *perf_events;
@@ -423,6 +427,17 @@ enum event_trigger_type {
ETT_EVENT_ENABLE = (1 << 3),
};
+#ifdef CONFIG_STM_TRACE_EVENT
+extern void trace_event_stm_log(struct ftrace_event_buffer *fbuffer);
+extern void trace_event_buf_vprintf(struct trace_buffer_stm *tb,
+ const char *fmt, ...) __attribute__ ((weak));
+extern void stm_trace_event_write(const char *buf, unsigned len);
+#else
+static inline void trace_event_stm_log(struct ftrace_event_buffer *fbuffer) {}
+static inline void trace_event_buf_vprintf(struct trace_buffer_stm *tb,
+ const char *fmt, ...) {}
+#endif
+
extern int filter_match_preds(struct event_filter *filter, void *rec);
extern int filter_check_discard(struct ftrace_event_file *file, void *rec,
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 37d4b10..20c7228 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -303,6 +303,50 @@ TRACE_MAKE_SYSTEM_STR();
#undef DECLARE_EVENT_CLASS
#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
+static notrace void \
+trace_event_stm_output_##call(struct trace_seq *tmp_seq, \
+ void *entry, \
+ struct trace_buffer_stm *trace_buf) \
+{ \
+ struct ftrace_raw_##call *field = entry; \
+ struct trace_seq *p = tmp_seq; \
+ \
+ trace_seq_init(p); \
+ \
+ trace_event_buf_vprintf(trace_buf, print); \
+ \
+ return; \
+}
+
+#undef DEFINE_EVENT_PRINT
+#define DEFINE_EVENT_PRINT(template, call, proto, args, print) \
+static notrace void \
+trace_event_stm_output_##call(struct trace_seq *tmp_seq, \
+ void *entry, \
+ struct trace_buffer_stm *trace_buf) \
+{ \
+ struct trace_seq *p = tmp_seq; \
+ struct trace_entry *ent = entry; \
+ struct ftrace_raw_##template *field; \
+ \
+ if (ent->type != event_##call.event.type) { \
+ WARN_ON_ONCE(1); \
+ return; \
+ } \
+ \
+ field = (typeof(field))entry; \
+ \
+ trace_seq_init(p); \
+ \
+ trace_event_buf_vprintf(trace_buf, print); \
+ \
+ return; \
+}
+
+#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
+
+#undef DECLARE_EVENT_CLASS
+#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
static notrace enum print_line_t \
ftrace_raw_output_##call(struct trace_iterator *iter, int flags, \
struct trace_event *trace_event) \
@@ -683,6 +727,7 @@ ftrace_raw_event_##call(void *__data, proto) \
{ assign; } \
\
ftrace_event_buffer_commit(&fbuffer); \
+ trace_event_stm_log(&fbuffer); \
}
/*
* The ftrace_test_probe is compiled out, it is only here as a build time check
@@ -742,6 +787,7 @@ static struct ftrace_event_call __used event_##call = { \
.event.funcs = &ftrace_event_type_funcs_##template, \
.print_fmt = print_fmt_##template, \
.flags = TRACE_EVENT_FL_TRACEPOINT, \
+ .output_stm = trace_event_stm_output_##template, \
}; \
static struct ftrace_event_call __used \
__attribute__((section("_ftrace_events"))) *__event_##call = &event_##call
@@ -759,6 +805,7 @@ static struct ftrace_event_call __used event_##call = { \
.event.funcs = &ftrace_event_type_funcs_##call, \
.print_fmt = print_fmt_##call, \
.flags = TRACE_EVENT_FL_TRACEPOINT, \
+ .output_stm = trace_event_stm_output_##call, \
}; \
static struct ftrace_event_call __used \
__attribute__((section("_ftrace_events"))) *__event_##call = &event_##call
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists