public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: acme@ghostprotocols.net, linux-kernel@vger.kernel.org
Cc: David Ahern <dsahern@gmail.com>, Jiri Olsa <jolsa@redhat.com>
Subject: [PATCH] perf tool: Ensure forward progress unwinding frames
Date: Sun,  1 Dec 2013 17:01:49 -0700	[thread overview]
Message-ID: <1385942509-11445-1-git-send-email-dsahern@gmail.com> (raw)

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)


             reply	other threads:[~2013-12-02  0:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-02  0:01 David Ahern [this message]
2013-12-08 17:46 ` [PATCH] perf tool: Ensure forward progress unwinding frames David Ahern
2013-12-09 10:02   ` Jiri Olsa
2013-12-09 14:05     ` David Ahern
2013-12-09 14:16       ` Jiri Olsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1385942509-11445-1-git-send-email-dsahern@gmail.com \
    --to=dsahern@gmail.com \
    --cc=acme@ghostprotocols.net \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox