* [PATCH] perf report: fix bug in raw smple parsing
@ 2012-03-17 22:23 Stephane Eranian
2012-03-31 7:41 ` [tip:perf/urgent] perf tools: Fix bug in raw sample parsing tip-bot for Stephane Eranian
0 siblings, 1 reply; 2+ messages in thread
From: Stephane Eranian @ 2012-03-17 22:23 UTC (permalink / raw)
To: linux-kernel; +Cc: peterz, acme, mingo, dsahern
In perf_event__parse_sample(), the array variable was not incremented
by the amount of data used by the raw_data. That was okay until
we added PERF_SAMPLE_BRANCH_STACK which depends on the array variable
pointing to the beginning of the branch stack data. But that was not
the case if branch stack was combined with raw mode sampling. That led
to bogus branch stack addresses and count.
The bug would show up with:
$ perf record -R -b foo
This patch fixes the problem by correctly moving the array pointer
forward for RAW samples.
Signed-off-by: Stephane Eranian <eranian@google.com>
---
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index f421f7c..9f35d92 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -578,6 +578,8 @@ int perf_event__parse_sample(const union perf_event *event, u64 type,
return -EFAULT;
data->raw_data = (void *) pdata;
+
+ array = (void *)array + data->raw_size + sizeof(u32);
}
if (type & PERF_SAMPLE_BRANCH_STACK) {
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [tip:perf/urgent] perf tools: Fix bug in raw sample parsing
2012-03-17 22:23 [PATCH] perf report: fix bug in raw smple parsing Stephane Eranian
@ 2012-03-31 7:41 ` tip-bot for Stephane Eranian
0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Stephane Eranian @ 2012-03-31 7:41 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, linux-kernel, eranian, hpa, mingo, peterz, dsahern, tglx,
mingo
Commit-ID: fa30c964c0ac31a705a4f86072267a42343c4158
Gitweb: http://git.kernel.org/tip/fa30c964c0ac31a705a4f86072267a42343c4158
Author: Stephane Eranian <eranian@google.com>
AuthorDate: Sat, 17 Mar 2012 23:23:18 +0100
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 26 Mar 2012 15:36:03 -0300
perf tools: Fix bug in raw sample parsing
In perf_event__parse_sample(), the array variable was not incremented
by the amount of data used by the raw_data.
That was okay until we added PERF_SAMPLE_BRANCH_STACK which depends on
the array variable pointing to the beginning of the branch stack data.
But that was not the case if branch stack was combined with raw mode
sampling. That led to bogus branch stack addresses and count.
The bug would show up with:
$ perf record -R -b foo
This patch fixes the problem by correctly moving the array pointer
forward for RAW samples.
Signed-off-by: Stephane Eranian <eranian@google.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20120317222317.GA8803@quad
[ committer note: Fix also later submitted by Jiri Olsa ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/evsel.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index d9da62a..8c13dbc 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -580,6 +580,8 @@ int perf_event__parse_sample(const union perf_event *event, u64 type,
return -EFAULT;
data->raw_data = (void *) pdata;
+
+ array = (void *)array + data->raw_size + sizeof(u32);
}
if (type & PERF_SAMPLE_BRANCH_STACK) {
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-03-31 7:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-17 22:23 [PATCH] perf report: fix bug in raw smple parsing Stephane Eranian
2012-03-31 7:41 ` [tip:perf/urgent] perf tools: Fix bug in raw sample parsing tip-bot for Stephane Eranian
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox