Skip to contentSkip to conversation

perf, tool: Fix prefix matching for kernel maps

PATCH In review Jiri Olsa 2 participants 3 messages Feb 5, 2012 – Feb 7, 2012 perf events

lore
Share & tools
lore

Jiri Olsa

author
#0 lore raw

PATCH 1/1 perf, tool: Fix prefix matching for kernel maps

In some perf ancient versions we used '[kernel.kallsyms._text]' as the name for the kernel map.

This got changed with commit:
perf: 'perf kvm' tool for monitoring guest performance from host commit a1645ce12adb6c9cc9e19d7695466204e3f017fe
Author: Zhang, Yanmin <[email protected]>

and we started to use following name '[kernel.kallsyms]_text'.

This name change is important for the report code dealing with ancient perf data. When processing the kernel map event, we need to recognize the old naming (dont match the last ']') and initialize the kernel map correctly.

The subsequent call to maps__set_kallsyms_ref_reloc_sym deals with the superfluous ']' to get correct symbol name.

---
 tools/perf/util/event.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
tools/perf/util/event.c +1 -1
index 73ddaf0..2044324 100644
@@ -554,7 +554,7 @@ static int perf_event__process_kernel_mmap(struct perf_tool *tool __used,
 
 	is_kernel_mmap = memcmp(event->mmap.filename,
 				kmmap_prefix,
-				strlen(kmmap_prefix)) == 0;
+				strlen(kmmap_prefix) - 1) == 0;
 	if (event->mmap.filename[0] == '/' ||
 	    (!is_kernel_mmap && event->mmap.filename[0] == '[')) {
 
Signature · 1 line
1.7.4.4
#1 lore raw

Em Sun, Feb 05, 2012 at 06:11:05PM +0100, Jiri Olsa escreveu:

Quoted 10 lines

In some perf ancient versions we used '[kernel.kallsyms._text]' as the name for the kernel map.

This got changed with commit:
perf: 'perf kvm' tool for monitoring guest performance from host commit a1645ce12adb6c9cc9e19d7695466204e3f017fe
Author: Zhang, Yanmin <[email protected]>

and we started to use following name '[kernel.kallsyms]_text'.

Quoted 7 lines

This name change is important for the report code dealing with ancient perf data. When processing the kernel map event, we need to recognize the old naming (dont match the last ']') and initialize the kernel map correctly.

The subsequent call to maps__set_kallsyms_ref_reloc_sym deals with the superfluous ']' to get correct symbol name.

Good catch & fix, thanks.

People curious about that -1 can look at 'git blame' to read the above historical explanation ;-)

- Arnaldo

Quoted 20 lines
---
 tools/perf/util/event.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
tools/perf/util/event.c +1 -1
index 73ddaf0..2044324 100644
@@ -554,7 +554,7 @@ static int perf_event__process_kernel_mmap(struct perf_tool *tool __used,
 
 	is_kernel_mmap = memcmp(event->mmap.filename,
 				kmmap_prefix,
-				strlen(kmmap_prefix)) == 0;
+				strlen(kmmap_prefix) - 1) == 0;
 	if (event->mmap.filename[0] == '/' ||
 	    (!is_kernel_mmap && event->mmap.filename[0] == '[')) {
 
Signature · 1 line
1.7.4.4
#2 lore raw

[tip:perf/core] perf tools: Fix prefix matching for kernel maps

In reply to Jiri Olsa
Commit-ID:  bf32c9ebc9890764c7a9984e3a0c8a57a059753d
Gitweb:     http://git.kernel.org/tip/bf32c9ebc9890764c7a9984e3a0c8a57a059753d
Author:     Jiri Olsa <[email protected]>
AuthorDate: Sun, 5 Feb 2012 18:11:05 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 6 Feb 2012 18:57:39 -0200

perf tools: Fix prefix matching for kernel maps

In some perf ancient versions we used '[kernel.kallsyms._text]' as the name for the kernel map.

This got changed with commit:
perf: 'perf kvm' tool for monitoring guest performance from host commit a1645ce12adb6c9cc9e19d7695466204e3f017fe
Author: Zhang, Yanmin <[email protected]>

and we started to use following name '[kernel.kallsyms]_text'.

This name change is important for the report code dealing with ancient perf data. When processing the kernel map event, we need to recognize the old naming (dont match the last ']') and initialize the kernel map correctly.

The subsequent call to maps__set_kallsyms_ref_reloc_sym deals with the superfluous ']' to get correct symbol name.

---
 tools/perf/util/event.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
tools/perf/util/event.c +1 -1
index 73ddaf0..2044324 100644
@@ -554,7 +554,7 @@ static int perf_event__process_kernel_mmap(struct perf_tool *tool __used,
 
 	is_kernel_mmap = memcmp(event->mmap.filename,
 				kmmap_prefix,
-				strlen(kmmap_prefix)) == 0;
+				strlen(kmmap_prefix) - 1) == 0;
 	if (event->mmap.filename[0] == '/' ||
 	    (!is_kernel_mmap && event->mmap.filename[0] == '[')) {