aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2013-08-27 04:23:05 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-08-29 14:11:29 -0400
commit07940293ba7a43070cdebda952b0e6025d80a383 (patch)
tree11108e1eaa4251a59593584124f8971753c5e9fb /tools
parent03b6ea9b91e0914caa847a1ade759af549555298 (diff)
perf callchain: Remove unnecessary validation
Now that the sample parsing correctly checks data sizes there is no reason for it to be done again for callchains. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1377591794-30553-4-git-send-email-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/callchain.c8
-rw-r--r--tools/perf/util/callchain.h5
-rw-r--r--tools/perf/util/session.c20
3 files changed, 0 insertions, 33 deletions
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index 4fee33b229b0..482f68081cd8 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -21,14 +21,6 @@
21 21
22__thread struct callchain_cursor callchain_cursor; 22__thread struct callchain_cursor callchain_cursor;
23 23
24bool ip_callchain__valid(struct ip_callchain *chain,
25 const union perf_event *event)
26{
27 unsigned int chain_size = event->header.size;
28 chain_size -= (unsigned long)&event->ip.__more_data - (unsigned long)event;
29 return chain->nr * sizeof(u64) <= chain_size;
30}
31
32#define chain_for_each_child(child, parent) \ 24#define chain_for_each_child(child, parent) \
33 list_for_each_entry(child, &parent->children, siblings) 25 list_for_each_entry(child, &parent->children, siblings)
34 26
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
index 812d5a0ff2bc..2b585bc308cf 100644
--- a/tools/perf/util/callchain.h
+++ b/tools/perf/util/callchain.h
@@ -109,11 +109,6 @@ int callchain_append(struct callchain_root *root,
109int callchain_merge(struct callchain_cursor *cursor, 109int callchain_merge(struct callchain_cursor *cursor,
110 struct callchain_root *dst, struct callchain_root *src); 110 struct callchain_root *dst, struct callchain_root *src);
111 111
112struct ip_callchain;
113union perf_event;
114
115bool ip_callchain__valid(struct ip_callchain *chain,
116 const union perf_event *event);
117/* 112/*
118 * Initialize a cursor before adding entries inside, but keep 113 * Initialize a cursor before adding entries inside, but keep
119 * the previously allocated entries as a cache. 114 * the previously allocated entries as a cache.
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 57b6f38f246a..07590c3c68b8 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -997,22 +997,6 @@ static int perf_session_deliver_event(struct perf_session *session,
997 } 997 }
998} 998}
999 999
1000static int perf_session__preprocess_sample(struct perf_session *session,
1001 union perf_event *event, struct perf_sample *sample)
1002{
1003 if (event->header.type != PERF_RECORD_SAMPLE ||
1004 !(perf_evlist__sample_type(session->evlist) & PERF_SAMPLE_CALLCHAIN))
1005 return 0;
1006
1007 if (!ip_callchain__valid(sample->callchain, event)) {
1008 pr_debug("call-chain problem with event, skipping it.\n");
1009 ++session->stats.nr_invalid_chains;
1010 session->stats.total_invalid_chains += sample->period;
1011 return -EINVAL;
1012 }
1013 return 0;
1014}
1015
1016static int perf_session__process_user_event(struct perf_session *session, union perf_event *event, 1000static int perf_session__process_user_event(struct perf_session *session, union perf_event *event,
1017 struct perf_tool *tool, u64 file_offset) 1001 struct perf_tool *tool, u64 file_offset)
1018{ 1002{
@@ -1075,10 +1059,6 @@ static int perf_session__process_event(struct perf_session *session,
1075 if (ret) 1059 if (ret)
1076 return ret; 1060 return ret;
1077 1061
1078 /* Preprocess sample records - precheck callchains */
1079 if (perf_session__preprocess_sample(session, event, &sample))
1080 return 0;
1081
1082 if (tool->ordered_samples) { 1062 if (tool->ordered_samples) {
1083 ret = perf_session_queue_event(session, event, &sample, 1063 ret = perf_session_queue_event(session, event, &sample,
1084 file_offset); 1064 file_offset);