lkml.org 
[lkml]   [2012]   [Jan]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 6/7] ftrace, perf: Distinguish ftrace function event field type
Date
Adding FILTER_TRACE_FN event field type for function tracepoint
event, so it can be properly recognized within filtering code.

Currently all fields of ftrace subsystem events share the common
field type FILTER_OTHER. Since the function trace fields need special
care within the filtering code we need to recognize it properly,
hence adding the FILTER_TRACE_FN event type.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
include/linux/ftrace_event.h | 1 +
kernel/trace/trace_events_filter.c | 7 ++++++-
kernel/trace/trace_export.c | 25 ++++++++++++++++++++-----
3 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 2bf677c..dd478fc 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -245,6 +245,7 @@ enum {
FILTER_STATIC_STRING,
FILTER_DYN_STRING,
FILTER_PTR_STRING,
+ FILTER_TRACE_FN,
};

#define EVENT_STORAGE_SIZE 128
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index 24aee71..eb04a2a 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -900,6 +900,11 @@ int filter_assign_type(const char *type)
return FILTER_OTHER;
}

+static bool is_function_field(struct ftrace_event_field *field)
+{
+ return field->filter_type == FILTER_TRACE_FN;
+}
+
static bool is_string_field(struct ftrace_event_field *field)
{
return field->filter_type == FILTER_DYN_STRING ||
@@ -987,7 +992,7 @@ static int init_pred(struct filter_parse_state *ps,
fn = filter_pred_strloc;
else
fn = filter_pred_pchar;
- } else {
+ } else if (!is_function_field(field)) {
if (field->is_signed)
ret = strict_strtoll(pred->regex.pattern, 0, &val);
else
diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c
index 867653c..46c35e2 100644
--- a/kernel/trace/trace_export.c
+++ b/kernel/trace/trace_export.c
@@ -67,7 +67,7 @@ static void __always_unused ____ftrace_check_##name(void) \
ret = trace_define_field(event_call, #type, #item, \
offsetof(typeof(field), item), \
sizeof(field.item), \
- is_signed_type(type), FILTER_OTHER); \
+ is_signed_type(type), filter_type); \
if (ret) \
return ret;

@@ -77,7 +77,7 @@ static void __always_unused ____ftrace_check_##name(void) \
offsetof(typeof(field), \
container.item), \
sizeof(field.container.item), \
- is_signed_type(type), FILTER_OTHER); \
+ is_signed_type(type), filter_type); \
if (ret) \
return ret;

@@ -91,7 +91,7 @@ static void __always_unused ____ftrace_check_##name(void) \
ret = trace_define_field(event_call, event_storage, #item, \
offsetof(typeof(field), item), \
sizeof(field.item), \
- is_signed_type(type), FILTER_OTHER); \
+ is_signed_type(type), filter_type); \
mutex_unlock(&event_storage_mutex); \
if (ret) \
return ret; \
@@ -104,7 +104,7 @@ static void __always_unused ____ftrace_check_##name(void) \
offsetof(typeof(field), \
container.item), \
sizeof(field.container.item), \
- is_signed_type(type), FILTER_OTHER); \
+ is_signed_type(type), filter_type); \
if (ret) \
return ret;

@@ -112,10 +112,24 @@ static void __always_unused ____ftrace_check_##name(void) \
#define __dynamic_array(type, item) \
ret = trace_define_field(event_call, #type, #item, \
offsetof(typeof(field), item), \
- 0, is_signed_type(type), FILTER_OTHER);\
+ 0, is_signed_type(type), filter_type);\
if (ret) \
return ret;

+#define FILTER_TYPE_TRACE_FN FILTER_TRACE_FN
+#define FILTER_TYPE_TRACE_GRAPH_ENT FILTER_OTHER
+#define FILTER_TYPE_TRACE_GRAPH_RET FILTER_OTHER
+#define FILTER_TYPE_TRACE_CTX FILTER_OTHER
+#define FILTER_TYPE_TRACE_WAKE FILTER_OTHER
+#define FILTER_TYPE_TRACE_STACK FILTER_OTHER
+#define FILTER_TYPE_TRACE_USER_STACK FILTER_OTHER
+#define FILTER_TYPE_TRACE_BPRINT FILTER_OTHER
+#define FILTER_TYPE_TRACE_PRINT FILTER_OTHER
+#define FILTER_TYPE_TRACE_MMIO_RW FILTER_OTHER
+#define FILTER_TYPE_TRACE_MMIO_MAP FILTER_OTHER
+#define FILTER_TYPE_TRACE_BRANCH FILTER_OTHER
+#define FILTER_TYPE(arg) FILTER_TYPE_##arg
+
#undef FTRACE_ENTRY
#define FTRACE_ENTRY(name, struct_name, id, tstruct, print) \
int \
@@ -123,6 +137,7 @@ ftrace_define_fields_##name(struct ftrace_event_call *event_call) \
{ \
struct struct_name field; \
int ret; \
+ int filter_type = FILTER_TYPE(id); \
\
tstruct; \
\
--
1.7.1


\
 
 \ /
  Last update: 2012-01-18 19:47    [W:0.570 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site