perf TUI fails with "failed to process type: 64"
Subsystems (2)
Hi,
Updating to mainline as of last night, I started seeing the following error when running the perf report TUI:
0x46068 [0x8]: failed to process type: 68
This event is just PERF_RECORD_FINISHED_ROUND:
0x46068 [0x8]: event: 68
.
. ... raw event: size 8 bytes
. 0000: 44 00 00 00 00 00 08 00 D.......
0x46068 [0x8]: PERF_RECORD_FINISHED_ROUND
Which of course is not our error. It took me a while to find the real culprit:
14c00-14c00 g exc_virt_0x4c00_system_call
A zero length symbol, which __symbol__inc_addr_samples() barfs on:
if (addr < sym->start || addr >= sym->end) {
...
return -ERANGE;Seems like we have 3 bugs here:
1. Output the real source of the error instead of PERF_RECORD_FINISHED_ROUND
2. Don't exit the TUI if we find a sample on a zero length symbol
3. Why do we have zero length symbols in the first place? Does the recent ppc64 exception clean up have something to do with it?
Anton
Michael Ellerman
reviewerQuoted 14 lines · Anton Blanchard
Hi,
Updating to mainline as of last night, I started seeing the following error when running the perf report TUI:
0x46068[0x8]: failed to process type: 68This event is just
PERF_RECORD_FINISHED_ROUND:
0x46068[0x8]: event: 68
.
. ... raw event: size 8 bytes
. 0000: 44 00 00 00 00 00 08 00 D.......
Quoted 6 lines
0x46068[0x8]:PERF_RECORD_FINISHED_ROUNDWhich of course is not our error. It took me a while to find the real culprit:
14c00-14c00 g
exc_virt_0x4c00_system_call
^
What's this? The address? If so it's wrong?
Quoted 7 lines
A zero length symbol, which
__symbol__inc_addr_samples()barfs on:if (addr < sym->start || addr >= sym->end) { ... return -ERANGE;Seems like we have 3 bugs here:
...
Quoted 3 lines
3. Why do we have zero length symbols in the first place? Does the recent ppc64 exception clean up have something to do with it?
Seems likely. But I can't see why.
AFAICS we have never emitted a size for those symbols:
Old:
$ nm --print-size build/vmlinux | grep -w system_call_relon_pSeries c000000000004c00 T system_call_relon_pSeries
New:
$ nm --print-size build/vmlinux | grep -w exc_virt_0x4c00_system_call c000000000004c00 T exc_virt_0x4c00_system_call
It also doesn't look like we're emitting another symbol with the same address, which has caused confusion in the past:
Old:c000000000004c00 T exc_virt_0x4c00_system_callc000000000004d00 T exc_virt_0x4d00_single_step
New:c000000000004c00 T system_call_relon_pSeriesc000000000004d00 T single_step_relon_pSeries
So more digging required.
cheers
Nicholas Piggin
reviewerQuoted 58 lines · On Mon, 10 Oct 2016 16:02:07 +1100 Michael Ellerman <[email protected]> wrote:
Quoted 14 lines · Anton Blanchard
Hi,
Updating to mainline as of last night, I started seeing the following error when running the perf report TUI:
0x46068[0x8]: failed to process type: 68This event is just
PERF_RECORD_FINISHED_ROUND:
0x46068[0x8]: event: 68
.
. ... raw event: size 8 bytes
. 0000: 44 00 00 00 00 00 08 00 D.......Quoted 6 lines
0x46068[0x8]:PERF_RECORD_FINISHED_ROUNDWhich of course is not our error. It took me a while to find the real culprit:
14c00-14c00 g
exc_virt_0x4c00_system_call^
What's this? The address? If so it's wrong?Quoted 7 lines
A zero length symbol, which
__symbol__inc_addr_samples()barfs on:if (addr < sym->start || addr >= sym->end) { ... return -ERANGE;Seems like we have 3 bugs here:
...
Quoted 3 lines
3. Why do we have zero length symbols in the first place? Does the recent ppc64 exception clean up have something to do with it?
Seems likely. But I can't see why.
AFAICS we have never emitted a size for those symbols:
Old:
$ nm --print-size build/vmlinux | grep -w system_call_relon_pSeries c000000000004c00 T system_call_relon_pSeriesNew:
$ nm --print-size build/vmlinux | grep -w exc_virt_0x4c00_system_call c000000000004c00 T exc_virt_0x4c00_system_callIt also doesn't look like we're emitting another symbol with the same address, which has caused confusion in the past:
Old:
c000000000004c00Texc_virt_0x4c00_system_callc000000000004d00Texc_virt_0x4d00_single_step
Quoted 6 lines
New:
c000000000004c00Tsystem_call_relon_pSeriesc000000000004d00Tsingle_step_relon_pSeriesSo more digging required.
Yeah, strange. Maybe perf changes?
We were talking about adding size and type to the exception symbols though.
Hi Michael,
Quoted 3 lines
Quoted 1 line
14c00-14c00 g
exc_virt_0x4c00_system_call^
What's this? The address? If so it's wrong?
Offset into the binary I think, there's one 64kB page of ELF gunk at the start.
Quoted 20 lines
Seems likely. But I can't see why.
AFAICS we have never emitted a size for those symbols:
Old:
$ nm --print-size build/vmlinux | grep -w system_call_relon_pSeries c000000000004c00 T system_call_relon_pSeriesNew:
$ nm --print-size build/vmlinux | grep -w exc_virt_0x4c00_system_call c000000000004c00 T exc_virt_0x4c00_system_callIt also doesn't look like we're emitting another symbol with the same address, which has caused confusion in the past:
Old:
c000000000004c00Texc_virt_0x4c00_system_callc000000000004d00Texc_virt_0x4d00_single_step
Quoted 5 lines
New:
c000000000004c00Tsystem_call_relon_pSeriesc000000000004d00Tsingle_step_relon_pSeriesSo more digging required.
Thanks for checking, it's starting to sound like a perf bug.
Anton
Michael Ellerman
reviewerQuoted 6 lines · Anton Blanchard
Quoted 3 lines
Quoted 1 line
14c00-14c00 g
exc_virt_0x4c00_system_call^
What's this? The address? If so it's wrong?Offset into the binary I think, there's one 64kB page of ELF gunk at the start.
Ah OK makes sense.
Quoted 3 lines
Quoted 1 line
So more digging required.
Thanks for checking, it's starting to sound like a perf bug.
Yeah possibly. I'll build an updated perf tomorrow and see if I can reproduce.
As an aside, it looks like it would be easy to set the size with the new macro. Does the patch below help at all?
The other thing Nick mentioned is we could set the type of those symbols to function, though that's not entirely correct. But it might help perf and probably wouldn't break anything else (that I can think of right now anyway).
cheers
arch/powerpc/include/asm/head-64.h +1 -0
@@ -122,6 +122,7 @@ name: .error "Fixed entry overflow"; \ .abort; \ .endif; \ + .size name, (. - name); \ . = ((end) - sname##_start); \
Hi,
I forgot about the set of issues below. Michael had a suggested powerpc fix for 3, but it it would be nice to fix the perf bugs in 1 and 2.
Anton
--
Quoted 37 lines
Updating to mainline as of last night, I started seeing the following error when running the perf report TUI:
0x46068[0x8]: failed to process type: 68This event is just
PERF_RECORD_FINISHED_ROUND:
0x46068[0x8]: event: 68
.
. ... raw event: size 8 bytes
. 0000: 44 00 00 00 00 00 08 00
D.......
0x46068[0x8]:PERF_RECORD_FINISHED_ROUNDWhich of course is not our error. It took me a while to find the real culprit:
14c00-14c00 g
exc_virt_0x4c00_system_callA zero length symbol, which
__symbol__inc_addr_samples()barfs on:if (addr < sym->start || addr >= sym->end) { ... return -ERANGE;Seems like we have 3 bugs here:
1. Output the real source of the error instead of
PERF_RECORD_FINISHED_ROUND2. Don't exit the TUI if we find a sample on a zero length symbol
3. Why do we have zero length symbols in the first place? Does the recent ppc64 exception clean up have something to do with it?
Anton
PATCH 1/1 perf TUI: Don't throw error for zero length symbols
perf report (with TUI) exits with error when it finds a sample of zero length symbol(i.e. addr == sym->start == sym->end). Actually these are valid samples. Don't exit TUI and show report with such symbols.
--- tools/perf/util/annotate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/util/annotate.c +2 -1
@@ -593,7 +593,8 @@ static int __symbol__inc_addr_samples(struct symbol *sym, struct map *map,pr_debug3 ("%s: addr=%#" PRIx64"\n" , __func__, map->unmap_ip (map, addr)); -if (addr < sym->start || addr >= sym->end) { +if ((addr < sym->start || addr >= sym->end) && + (addr != sym->end || sym->start != sym->end)) {pr_debug ("%s(%d): ERANGE! sym->name=%s, start=%#" PRIx64", addr=%#" PRIx64", end=%#" PRIx64"\n" , __func__, __LINE__, sym->name, sym->start, addr, sym->end);return -ERANGE ;
Signature · 1 line
1.8.3.1
Re: [PATCH] perf TUI: Don't throw error for zero length symbols
Hi Anton,
Quoted 5 lines · Ravi Bangoria
perf report (with TUI) exits with error when it finds a sample of zero length symbol(i.e. addr ==
sym->start==sym->end). Actually these are valid samples. Don't exit TUI and show report with such symbols.
This will solve 2nd issue.
3rd doesn't sound simple to fix. I tried to fix it by replacing pr_debug to pr_err when addr is out of symbol address range. But error message will get overwritten every time when subsequent pr_err gets executed.
Arnaldo, any suggestions?
-Ravi
Quoted 20 lines
Reported-by Anton Blanchard <[email protected]>Signed-off-by Ravi Bangoria <[email protected]>--- tools/perf/util/annotate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tools/perf/util/annotate.c +2
-1@@ -593,7 +593,8 @@ static int __symbol__inc_addr_samples(struct symbol *sym, struct map *map,pr_debug3 ("%s: addr=%#" PRIx64"\n" , __func__, map->unmap_ip (map, addr)); -if (addr < sym->start || addr >= sym->end) { +if ((addr < sym->start || addr >= sym->end) && + (addr != sym->end || sym->start != sym->end)) {pr_debug ("%s(%d): ERANGE! sym->name=%s, start=%#" PRIx64", addr=%#" PRIx64", end=%#" PRIx64"\n" , __func__, __LINE__, sym->name, sym->start, addr, sym->end);return -ERANGE ;
Re: [PATCH] perf TUI: Don't throw error for zero length symbols
Quoted 11 lines · Ravi Bangoria
Hi Anton,
Quoted 5 lines · Ravi Bangoria
perf report (with TUI) exits with error when it finds a sample of zero length symbol(i.e. addr ==
sym->start==sym->end). Actually these are valid samples. Don't exit TUI and show report with such symbols.This will solve 2nd issue.
3rd doesn't sound simple to fix.
Sorry, I mean 1st doesn't sound ...
Quoted 28 lines
I tried to fix it by replacing
pr_debugtopr_errwhen addr is out of symbol address range. But error message will get overwritten every time when subsequentpr_errgets executed.Arnaldo, any suggestions?
-Ravi
Quoted 20 lines
Reported-by Anton Blanchard <[email protected]>Signed-off-by Ravi Bangoria <[email protected]>--- tools/perf/util/annotate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tools/perf/util/annotate.c +2
-1@@ -593,7 +593,8 @@ static int __symbol__inc_addr_samples(struct symbol *sym, struct map *map,pr_debug3 ("%s: addr=%#" PRIx64"\n" , __func__, map->unmap_ip (map, addr)); -if (addr < sym->start || addr >= sym->end) { +if ((addr < sym->start || addr >= sym->end) && + (addr != sym->end || sym->start != sym->end)) {pr_debug ("%s(%d): ERANGE! sym->name=%s, start=%#" PRIx64", addr=%#" PRIx64", end=%#" PRIx64"\n" , __func__, __LINE__, sym->name, sym->start, addr, sym->end);return -ERANGE ;
Re: [PATCH] perf TUI: Don't throw error for zero length symbols
In reply to Ravi BangoriaHi Arnaldo,
Can you please pick this up if it looks good?
-Ravi
Quoted 26 lines · Ravi Bangoria
perf report (with TUI) exits with error when it finds a sample of zero length symbol(i.e. addr ==
sym->start==sym->end). Actually these are valid samples. Don't exit TUI and show report with such symbols.Reported-by Anton Blanchard <[email protected]>Signed-off-by Ravi Bangoria <[email protected]>--- tools/perf/util/annotate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tools/perf/util/annotate.c +2
-1@@ -593,7 +593,8 @@ static int __symbol__inc_addr_samples(struct symbol *sym, struct map *map,pr_debug3 ("%s: addr=%#" PRIx64"\n" , __func__, map->unmap_ip (map, addr)); -if (addr < sym->start || addr >= sym->end) { +if ((addr < sym->start || addr >= sym->end) && + (addr != sym->end || sym->start != sym->end)) {pr_debug ("%s(%d): ERANGE! sym->name=%s, start=%#" PRIx64", addr=%#" PRIx64", end=%#" PRIx64"\n" , __func__, __LINE__, sym->name, sym->start, addr, sym->end);return -ERANGE ;
Anton Blanchard
Tested-byRe: [PATCH] perf TUI: Don't throw error for zero length symbols
Hi Ravi,
Quoted 6 lines
Quoted 6 lines
perf report (with TUI) exits with error when it finds a sample of zero length symbol(i.e. addr ==
sym->start==sym->end). Actually these are valid samples. Don't exit TUI and show report with such symbols.
You can add:
Also, since this issue makes perf report pretty much useless on ppc64, can we mark it for stable@, at least to get it into 4.9 where the ppc64 kernel changes that triggered this appeared?
Anton
Quoted 23 lines
Quoted 22 lines
Reported-by Anton Blanchard <[email protected]>Signed-off-by Ravi Bangoria <[email protected]>--- tools/perf/util/annotate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tools/perf/util/annotate.c +2
-1@@ -593,7 +593,8 @@ static int __symbol__inc_addr_samples(struct symbol *sym, struct map *map, pr_debug3("%s: addr=%#" PRIx64 "\n", __func__, map->unmap_ip(map, addr)); -if (addr < sym->start || addr >= sym->end) { +if ((addr < sym->start || addr >= sym->end) && + (addr != sym->end || sym->start != sym->end)) { pr_debug("%s(%d): ERANGE! sym->name=%s, start=%#"PRIx64 ", addr=%#" PRIx64 ", end=%#" PRIx64 "\n",
__func__,__LINE__,sym->name,sym->start, addr,sym->end); return-ERANGE;
Arnaldo Carvalho de Melo
maintainerRe: [PATCH] perf TUI: Don't throw error for zero length symbols
Em Sat, Dec 17, 2016 at 07:27:54AM +1100, Anton Blanchard escreveu:
Quoted 9 lines
Hi Ravi,
Quoted 6 lines
Quoted 6 lines
perf report (with TUI) exits with error when it finds a sample of zero length symbol(i.e. addr ==
sym->start==sym->end). Actually these are valid samples. Don't exit TUI and show report with such symbols.
Quoted 7 lines
You can add:
Tested-by Anton Blanchard <[email protected]>Also, since this issue makes perf report pretty much useless on ppc64, can we mark it for stable@, at least to get it into 4.9 where the ppc64 kernel changes that triggered this appeared?
Ok, added it, will be in the next pull req to Ingo.
- Arnaldo
Quoted 25 lines
Anton
Quoted 23 lines
Quoted 22 lines
Reported-by Anton Blanchard <[email protected]>Signed-off-by Ravi Bangoria <[email protected]>--- tools/perf/util/annotate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tools/perf/util/annotate.c +2
-1@@ -593,7 +593,8 @@ static int __symbol__inc_addr_samples(struct symbol *sym, struct map *map, pr_debug3("%s: addr=%#" PRIx64 "\n", __func__, map->unmap_ip(map, addr)); -if (addr < sym->start || addr >= sym->end) { +if ((addr < sym->start || addr >= sym->end) && + (addr != sym->end || sym->start != sym->end)) { pr_debug("%s(%d): ERANGE! sym->name=%s, start=%#"PRIx64 ", addr=%#" PRIx64 ", end=%#" PRIx64 "\n",
__func__,__LINE__,sym->name,sym->start, addr,sym->end); return-ERANGE;
tip-bot for Ravi Bangoria
merge bot[tip:perf/urgent] perf annotate: Don't throw error for zero length symbols
In reply to Ravi Bangoriaperf annotate: Don't throw error for zero length symbols
Commit-ID: edee44be59190bf22d5c6e521f3852b7ff16862f Gitweb: http://git.kernel.org/tip/edee44be59190bf22d5c6e521f3852b7ff16862f Author: Ravi Bangoria <[email protected]> AuthorDate: Tue, 22 Nov 2016 14:10:50 +0530 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Tue, 20 Dec 2016 12:00:32 -0300
perf annotate: Don't throw error for zero length symbols
'perf report --tui' exits with error when it finds a sample of zero length symbol (i.e. addr == sym->start == sym->end). Actually these are valid samples. Don't exit TUI and show report with such symbols.
--- tools/perf/util/annotate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/util/annotate.c +2 -1
@@ -647,7 +647,8 @@ static int __symbol__inc_addr_samples(struct symbol *sym, struct map *map,pr_debug3 ("%s: addr=%#" PRIx64"\n" , __func__, map->unmap_ip (map, addr)); -if (addr < sym->start || addr >= sym->end) { +if ((addr < sym->start || addr >= sym->end) && + (addr != sym->end || sym->start != sym->end)) {pr_debug ("%s(%d): ERANGE! sym->name=%s, start=%#" PRIx64", addr=%#" PRIx64", end=%#" PRIx64"\n" , __func__, __LINE__, sym->name, sym->start, addr, sym->end);return -ERANGE ;