Skip to content

Commit 0794029

Browse files
ahunter6acmel
authored andcommitted
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>
1 parent 03b6ea9 commit 0794029

3 files changed

Lines changed: 0 additions & 33 deletions

File tree

‎tools/perf/util/callchain.c‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,6 @@
2121

2222
__thread struct callchain_cursor callchain_cursor;
2323

24-
bool 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-
3224
#define chain_for_each_child(child, parent) \
3325
list_for_each_entry(child, &parent->children, siblings)
3426

‎tools/perf/util/callchain.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,6 @@ int callchain_append(struct callchain_root *root,
109109
int callchain_merge(struct callchain_cursor *cursor,
110110
struct callchain_root *dst, struct callchain_root *src);
111111

112-
struct ip_callchain;
113-
union perf_event;
114-
115-
bool ip_callchain__valid(struct ip_callchain *chain,
116-
const union perf_event *event);
117112
/*
118113
* Initialize a cursor before adding entries inside, but keep
119114
* the previously allocated entries as a cache.

‎tools/perf/util/session.c‎

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -997,22 +997,6 @@ static int perf_session_deliver_event(struct perf_session *session,
997997
}
998998
}
999999

1000-
static 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-
10161000
static int perf_session__process_user_event(struct perf_session *session, union perf_event *event,
10171001
struct perf_tool *tool, u64 file_offset)
10181002
{
@@ -1075,10 +1059,6 @@ static int perf_session__process_event(struct perf_session *session,
10751059
if (ret)
10761060
return ret;
10771061

1078-
/* Preprocess sample records - precheck callchains */
1079-
if (perf_session__preprocess_sample(session, event, &sample))
1080-
return 0;
1081-
10821062
if (tool->ordered_samples) {
10831063
ret = perf_session_queue_event(session, event, &sample,
10841064
file_offset);

0 commit comments

Comments
 (0)