Skip to contentSkip to conversation

perf, tool: Fix the array pointer to follow event data properly

PATCH In review Jiri Olsa 4 participants 4 messages Mar 24, 2012 – Mar 25, 2012 perf events

lore
Share & tools
lore

Jiri Olsa

author
#0 lore raw

PATCH 1/1 perf, tool: Fix the array pointer to follow event data properly

Currently we dont update the 'array' pointer properly after processing the RAW data. This way perf might report wrong data for branch stack if it is used along with tracepoint sample.

I'm not sure tracepoint could be connected with branch stack, but I think the array pointer should have correct value after each sample processing.

---
 tools/perf/util/evsel.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
tools/perf/util/evsel.c +1 -0
index d9da62a..56a96896 100644
@@ -580,6 +580,7 @@ int perf_event__parse_sample(const union perf_event *event, u64 type,
 			return -EFAULT;
 
 		data->raw_data = (void *) pdata;
+		array = (u64 *)(((char *)array) + data->raw_size + sizeof(u32));
 	}
 
 	if (type & PERF_SAMPLE_BRANCH_STACK) {
Signature · 1 line
1.7.7.6
#1 lore raw

Stephane submitted a similar patch a week ago:
https://lkml.org/lkml/2012/3/17/91

David

Quoted 25 lines · Jiri Olsa

Currently we dont update the 'array' pointer properly after processing the RAW data. This way perf might report wrong data for branch stack if it is used along with tracepoint sample.

I'm not sure tracepoint could be connected with branch stack, but I think the array pointer should have correct value after each sample processing.

---
  tools/perf/util/evsel.c |    1 +
  1 files changed, 1 insertions(+), 0 deletions(-)
tools/perf/util/evsel.c +1 -0
index d9da62a..56a96896 100644
@@ -580,6 +580,7 @@ int perf_event__parse_sample(const union perf_event *event, u64 type,
  			return -EFAULT;
 
  		data->raw_data = (void *) pdata;
+		array = (u64 *)(((char *)array) + data->raw_size + sizeof(u32));
  	}
 
  	if (type&  PERF_SAMPLE_BRANCH_STACK) {
#2 lore raw

Yes, and I haven't heard back since then

Quoted 37 lines · David Ahern

Stephane submitted a similar patch a week ago:
https://lkml.org/lkml/2012/3/17/91

David

Quoted 28 lines · Jiri Olsa

Currently we dont update the 'array' pointer properly after processing the RAW data. This way perf might report wrong data for branch stack if it is used along with tracepoint sample.

I'm not sure tracepoint could be connected with branch stack, but I think the array pointer should have correct value after each sample processing.

---
 tools/perf/util/evsel.c |    1 +

 1 files changed, 1 insertions(+), 0 deletions(-)
tools/perf/util/evsel.c +1 -0
index d9da62a..56a96896 100644
@@ -580,6 +580,7 @@ int perf_event__parse_sample(const union perf_event
 *event, u64 type,
                        return -EFAULT;
 
                data->raw_data = (void *) pdata;
+               array = (u64 *)(((char *)array) + data->raw_size +
 sizeof(u32));
        }

       if (type&  PERF_SAMPLE_BRANCH_STACK) {

#3 lore raw

Em Sat, Mar 24, 2012 at 06:21:05PM +0100, Stephane Eranian escreveu:

Quoted 5 lines

Yes, and I haven't heard back since then

Quoted 2 lines · David Ahern

Stephane submitted a similar patch a week ago:
https://lkml.org/lkml/2012/3/17/91

Gack, I updated one of my machines and the postfix setup had some issues with SELinux.

Yeah, I noticed its the same fix Stephane submitted last week and that I should have already sent Ingo's way.

Ingo, please apply the one from Stephane, next time I process it if you haven't yet I'll make sure it gets pushed.

- Arnaldo

Quoted 39 lines
Quoted 26 lines

David

Quoted 22 lines · Jiri Olsa

Currently we dont update the 'array' pointer properly after processing the RAW data. This way perf might report wrong data for branch stack if it is used along with tracepoint sample.

I'm not sure tracepoint could be connected with branch stack, but I think the array pointer should have correct value after each sample processing.

---
 tools/perf/util/evsel.c |    1 +

 1 files changed, 1 insertions(+), 0 deletions(-)
tools/perf/util/evsel.c +0 -0
index d9da62a..56a96896 100644
@@ -580,6 +580,7 @@ int perf_event__parse_sample(const union perf_event
 *event, u64 type,
                        return -EFAULT;
 
Quoted 8 lines
Quoted 6 lines
tools/perf/util/evsel.c +1 -0
                data->raw_data = (void *) pdata;
+               array = (u64 *)(((char *)array) + data->raw_size +
 sizeof(u32));
        }

       if (type&  PERF_SAMPLE_BRANCH_STACK) {

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/