* [PATCH] perf tool: Ensure forward progress unwinding frames
@ 2013-12-02 0:01 David Ahern
2013-12-08 17:46 ` David Ahern
0 siblings, 1 reply; 5+ messages in thread
From: David Ahern @ 2013-12-02 0:01 UTC (permalink / raw)
To: acme, linux-kernel; +Cc: David Ahern, Jiri Olsa
The dwarf option for callstacks is getting stuck on the unwind and showing
repeated frames. For example,
qemu-system-x86 13759 [001] 287663.084957: syscalls:sys_enter_futex: uaddr: 0x7f770a958700, op: 0x00000081, val: 0x00000001, utime: 0x7f75ea
7f7705fd23ea __lll_unlock_wake (/lib64/libpthread-2.14.90.so)
7f7705fcf045 _L_unlock_649 (/lib64/libpthread-2.14.90.so)
7f7705fcf045 _L_unlock_649 (/lib64/libpthread-2.14.90.so)
7f7705fcf045 _L_unlock_649 (/lib64/libpthread-2.14.90.so)
7f7705fcf045 _L_unlock_649 (/lib64/libpthread-2.14.90.so)
7f7705fcf045 _L_unlock_649 (/lib64/libpthread-2.14.90.so)
...
(Last frame repeats 126 times)
Catch that the same frame is hit multiple times and break out of the loop.
With this patch:
qemu-system-x86 13759 [001] 287663.084967: syscalls:sys_exit_futex: 0x1
7f7705fd23ea __lll_unlock_wake (/lib64/libpthread-2.14.90.so)
7f7705fcf045 _L_unlock_649 (/lib64/libpthread-2.14.90.so)
Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
---
tools/perf/util/unwind.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tools/perf/util/unwind.c b/tools/perf/util/unwind.c
index 0efd5393de85..817ffc1f3a00 100644
--- a/tools/perf/util/unwind.c
+++ b/tools/perf/util/unwind.c
@@ -563,6 +563,7 @@ static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb,
{
unw_addr_space_t addr_space;
unw_cursor_t c;
+ unw_word_t prev_ip = 0;
int ret;
addr_space = unw_create_addr_space(&accessors, 0);
@@ -579,6 +580,10 @@ static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb,
unw_word_t ip;
unw_get_reg(&c, UNW_REG_IP, &ip);
+ if (ip == prev_ip)
+ break;
+ prev_ip = ip;
+
ret = entry(ip, ui->thread, ui->machine, cb, arg);
}
--
1.8.3.4 (Apple Git-47)
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] perf tool: Ensure forward progress unwinding frames
2013-12-02 0:01 [PATCH] perf tool: Ensure forward progress unwinding frames David Ahern
@ 2013-12-08 17:46 ` David Ahern
2013-12-09 10:02 ` Jiri Olsa
0 siblings, 1 reply; 5+ messages in thread
From: David Ahern @ 2013-12-08 17:46 UTC (permalink / raw)
To: acme, linux-kernel, Jiri Olsa; +Cc: David Ahern
ping.. Jiri, any thoughts on this?
On 12/1/13, 5:01 PM, David Ahern wrote:
> The dwarf option for callstacks is getting stuck on the unwind and showing
> repeated frames. For example,
>
> qemu-system-x86 13759 [001] 287663.084957: syscalls:sys_enter_futex: uaddr: 0x7f770a958700, op: 0x00000081, val: 0x00000001, utime: 0x7f75ea
> 7f7705fd23ea __lll_unlock_wake (/lib64/libpthread-2.14.90.so)
> 7f7705fcf045 _L_unlock_649 (/lib64/libpthread-2.14.90.so)
> 7f7705fcf045 _L_unlock_649 (/lib64/libpthread-2.14.90.so)
> 7f7705fcf045 _L_unlock_649 (/lib64/libpthread-2.14.90.so)
> 7f7705fcf045 _L_unlock_649 (/lib64/libpthread-2.14.90.so)
> 7f7705fcf045 _L_unlock_649 (/lib64/libpthread-2.14.90.so)
> ...
> (Last frame repeats 126 times)
>
> Catch that the same frame is hit multiple times and break out of the loop.
>
> With this patch:
>
> qemu-system-x86 13759 [001] 287663.084967: syscalls:sys_exit_futex: 0x1
> 7f7705fd23ea __lll_unlock_wake (/lib64/libpthread-2.14.90.so)
> 7f7705fcf045 _L_unlock_649 (/lib64/libpthread-2.14.90.so)
>
> Signed-off-by: David Ahern <dsahern@gmail.com>
> Cc: Jiri Olsa <jolsa@redhat.com>
> ---
> tools/perf/util/unwind.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/tools/perf/util/unwind.c b/tools/perf/util/unwind.c
> index 0efd5393de85..817ffc1f3a00 100644
> --- a/tools/perf/util/unwind.c
> +++ b/tools/perf/util/unwind.c
> @@ -563,6 +563,7 @@ static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb,
> {
> unw_addr_space_t addr_space;
> unw_cursor_t c;
> + unw_word_t prev_ip = 0;
> int ret;
>
> addr_space = unw_create_addr_space(&accessors, 0);
> @@ -579,6 +580,10 @@ static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb,
> unw_word_t ip;
>
> unw_get_reg(&c, UNW_REG_IP, &ip);
> + if (ip == prev_ip)
> + break;
> + prev_ip = ip;
> +
> ret = entry(ip, ui->thread, ui->machine, cb, arg);
> }
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] perf tool: Ensure forward progress unwinding frames
2013-12-08 17:46 ` David Ahern
@ 2013-12-09 10:02 ` Jiri Olsa
2013-12-09 14:05 ` David Ahern
0 siblings, 1 reply; 5+ messages in thread
From: Jiri Olsa @ 2013-12-09 10:02 UTC (permalink / raw)
To: David Ahern; +Cc: acme, linux-kernel
On Sun, Dec 08, 2013 at 10:46:13AM -0700, David Ahern wrote:
> ping.. Jiri, any thoughts on this?
oops, missed that.. sry
>
> On 12/1/13, 5:01 PM, David Ahern wrote:
> >The dwarf option for callstacks is getting stuck on the unwind and showing
> >repeated frames. For example,
> >
> >qemu-system-x86 13759 [001] 287663.084957: syscalls:sys_enter_futex: uaddr: 0x7f770a958700, op: 0x00000081, val: 0x00000001, utime: 0x7f75ea
> > 7f7705fd23ea __lll_unlock_wake (/lib64/libpthread-2.14.90.so)
> > 7f7705fcf045 _L_unlock_649 (/lib64/libpthread-2.14.90.so)
> > 7f7705fcf045 _L_unlock_649 (/lib64/libpthread-2.14.90.so)
> > 7f7705fcf045 _L_unlock_649 (/lib64/libpthread-2.14.90.so)
> > 7f7705fcf045 _L_unlock_649 (/lib64/libpthread-2.14.90.so)
> > 7f7705fcf045 _L_unlock_649 (/lib64/libpthread-2.14.90.so)
> > ...
I wonder this is us or libunwind bug (or cfi code) ;-)
looks like you can reproduce..? are you using the latest libunwind?
> > (Last frame repeats 126 times)
> >
> >Catch that the same frame is hit multiple times and break out of the loop.
> >
> >With this patch:
> >
> >qemu-system-x86 13759 [001] 287663.084967: syscalls:sys_exit_futex: 0x1
> > 7f7705fd23ea __lll_unlock_wake (/lib64/libpthread-2.14.90.so)
> > 7f7705fcf045 _L_unlock_649 (/lib64/libpthread-2.14.90.so)
> >
> >Signed-off-by: David Ahern <dsahern@gmail.com>
> >Cc: Jiri Olsa <jolsa@redhat.com>
> >---
> > tools/perf/util/unwind.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> >diff --git a/tools/perf/util/unwind.c b/tools/perf/util/unwind.c
> >index 0efd5393de85..817ffc1f3a00 100644
> >--- a/tools/perf/util/unwind.c
> >+++ b/tools/perf/util/unwind.c
> >@@ -563,6 +563,7 @@ static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb,
> > {
> > unw_addr_space_t addr_space;
> > unw_cursor_t c;
> >+ unw_word_t prev_ip = 0;
> > int ret;
> >
> > addr_space = unw_create_addr_space(&accessors, 0);
> >@@ -579,6 +580,10 @@ static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb,
> > unw_word_t ip;
> >
> > unw_get_reg(&c, UNW_REG_IP, &ip);
> >+ if (ip == prev_ip)
> >+ break;
> >+ prev_ip = ip;
hum, how about recursion?
how about some counter and break after some insane value
and maybe display some warning..
qemu-system-x86 13759 [001] 287663.084967: syscalls:sys_exit_futex: 0x1
7f7705fd23ea __lll_unlock_wake (/lib64/libpthread-2.14.90.so)
7f7705fcf045 _L_unlock_649 (/lib64/libpthread-2.14.90.so)
warning: unwind broken
jirka
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] perf tool: Ensure forward progress unwinding frames
2013-12-09 10:02 ` Jiri Olsa
@ 2013-12-09 14:05 ` David Ahern
2013-12-09 14:16 ` Jiri Olsa
0 siblings, 1 reply; 5+ messages in thread
From: David Ahern @ 2013-12-09 14:05 UTC (permalink / raw)
To: Jiri Olsa; +Cc: acme, linux-kernel
On 12/9/13, 3:02 AM, Jiri Olsa wrote:
>> On 12/1/13, 5:01 PM, David Ahern wrote:
>>> The dwarf option for callstacks is getting stuck on the unwind and showing
>>> repeated frames. For example,
>>>
>>> qemu-system-x86 13759 [001] 287663.084957: syscalls:sys_enter_futex: uaddr: 0x7f770a958700, op: 0x00000081, val: 0x00000001, utime: 0x7f75ea
>>> 7f7705fd23ea __lll_unlock_wake (/lib64/libpthread-2.14.90.so)
>>> 7f7705fcf045 _L_unlock_649 (/lib64/libpthread-2.14.90.so)
>>> 7f7705fcf045 _L_unlock_649 (/lib64/libpthread-2.14.90.so)
>>> 7f7705fcf045 _L_unlock_649 (/lib64/libpthread-2.14.90.so)
>>> 7f7705fcf045 _L_unlock_649 (/lib64/libpthread-2.14.90.so)
>>> 7f7705fcf045 _L_unlock_649 (/lib64/libpthread-2.14.90.so)
>>> ...
>
> I wonder this is us or libunwind bug (or cfi code) ;-)
>
> looks like you can reproduce..? are you using the latest libunwind?
$ rpm -q libunwind
libunwind-0.99-2.20110424git1e10c293.fc16.x86_64
>
>
>>> (Last frame repeats 126 times)
>>>
>>> Catch that the same frame is hit multiple times and break out of the loop.
>>>
>>> With this patch:
>>>
>>> qemu-system-x86 13759 [001] 287663.084967: syscalls:sys_exit_futex: 0x1
>>> 7f7705fd23ea __lll_unlock_wake (/lib64/libpthread-2.14.90.so)
>>> 7f7705fcf045 _L_unlock_649 (/lib64/libpthread-2.14.90.so)
>>>
>>> Signed-off-by: David Ahern <dsahern@gmail.com>
>>> Cc: Jiri Olsa <jolsa@redhat.com>
>>> ---
>>> tools/perf/util/unwind.c | 5 +++++
>>> 1 file changed, 5 insertions(+)
>>>
>>> diff --git a/tools/perf/util/unwind.c b/tools/perf/util/unwind.c
>>> index 0efd5393de85..817ffc1f3a00 100644
>>> --- a/tools/perf/util/unwind.c
>>> +++ b/tools/perf/util/unwind.c
>>> @@ -563,6 +563,7 @@ static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb,
>>> {
>>> unw_addr_space_t addr_space;
>>> unw_cursor_t c;
>>> + unw_word_t prev_ip = 0;
>>> int ret;
>>>
>>> addr_space = unw_create_addr_space(&accessors, 0);
>>> @@ -579,6 +580,10 @@ static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb,
>>> unw_word_t ip;
>>>
>>> unw_get_reg(&c, UNW_REG_IP, &ip);
>>> + if (ip == prev_ip)
>>> + break;
>>> + prev_ip = ip;
>
> hum, how about recursion?
>
> how about some counter and break after some insane value
I chose > 1 as the insane value. Do you have a suggestion on something
else? 5? 10?
> and maybe display some warning..
>
> qemu-system-x86 13759 [001] 287663.084967: syscalls:sys_exit_futex: 0x1
> 7f7705fd23ea __lll_unlock_wake (/lib64/libpthread-2.14.90.so)
> 7f7705fcf045 _L_unlock_649 (/lib64/libpthread-2.14.90.so)
> warning: unwind broken
sure.
David
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] perf tool: Ensure forward progress unwinding frames
2013-12-09 14:05 ` David Ahern
@ 2013-12-09 14:16 ` Jiri Olsa
0 siblings, 0 replies; 5+ messages in thread
From: Jiri Olsa @ 2013-12-09 14:16 UTC (permalink / raw)
To: David Ahern; +Cc: acme, linux-kernel
On Mon, Dec 09, 2013 at 07:05:15AM -0700, David Ahern wrote:
> On 12/9/13, 3:02 AM, Jiri Olsa wrote:
> >>On 12/1/13, 5:01 PM, David Ahern wrote:
> >>>The dwarf option for callstacks is getting stuck on the unwind and showing
> >>>repeated frames. For example,
> >>>
> >>>qemu-system-x86 13759 [001] 287663.084957: syscalls:sys_enter_futex: uaddr: 0x7f770a958700, op: 0x00000081, val: 0x00000001, utime: 0x7f75ea
> >>> 7f7705fd23ea __lll_unlock_wake (/lib64/libpthread-2.14.90.so)
> >>> 7f7705fcf045 _L_unlock_649 (/lib64/libpthread-2.14.90.so)
> >>> 7f7705fcf045 _L_unlock_649 (/lib64/libpthread-2.14.90.so)
> >>> 7f7705fcf045 _L_unlock_649 (/lib64/libpthread-2.14.90.so)
> >>> 7f7705fcf045 _L_unlock_649 (/lib64/libpthread-2.14.90.so)
> >>> 7f7705fcf045 _L_unlock_649 (/lib64/libpthread-2.14.90.so)
> >>> ...
> >
> >I wonder this is us or libunwind bug (or cfi code) ;-)
> >
> >looks like you can reproduce..? are you using the latest libunwind?
>
> $ rpm -q libunwind
> libunwind-0.99-2.20110424git1e10c293.fc16.x86_64
[jolsa@krava libunwind]$ rpm -q libunwind
libunwind-1.1-2.fc19.x86_64
;-)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-12-09 14:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-02 0:01 [PATCH] perf tool: Ensure forward progress unwinding frames David Ahern
2013-12-08 17:46 ` David Ahern
2013-12-09 10:02 ` Jiri Olsa
2013-12-09 14:05 ` David Ahern
2013-12-09 14:16 ` Jiri Olsa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox