From: Namhyung Kim Subject: [BUG] perf top -G is broken Date: Wed, 02 May 2012 11:50:45 +0900 Message-ID: <87pqanmh2y.fsf@sejong.aot.lge.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from plane.gmane.org ([80.91.229.3]:60441 "EHLO plane.gmane.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757388Ab2EBCwK (ORCPT ); Tue, 1 May 2012 22:52:10 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1SPPfk-0005h8-FS for linux-perf-users@vger.kernel.org; Wed, 02 May 2012 04:52:08 +0200 Received: from 121.50.20.41 ([121.50.20.41]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 02 May 2012 04:52:08 +0200 Received: from namhyung.kim by 121.50.20.41 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 02 May 2012 04:52:08 +0200 Sender: linux-perf-users-owner@vger.kernel.org List-ID: To: linux-perf-users@vger.kernel.org Cc: Arnaldo Carvalho de Melo Hi, Some guy reported me that perf top -G is broken with segment fault. I can reproduce it on my system easily but the time is vary - few seconds to 30 minutes. I ran it with --stdio to get a core file: $ sudo ./perf top -G --stdio > /dev/null [sudo] password for namhyung: Failed to open /tmp/perf-1313.map, continuing without symbols Warning: empty node in callchain tree Warning: empty node in callchain tree /usr/lib64/libgvfscommon.so.0.0.0.#prelink#.SjIuuf was updated (is prelink enabled?). Restart the long running apps that use it! Warning: empty node in callchain tree Warning: empty node in callchain tree Warning: empty node in callchain tree Warning: empty node in callchain tree Warning: empty node in callchain tree Warning: empty node in callchain tree Warning: empty node in callchain tree Warning: empty node in callchain tree Warning: empty node in callchain tree Warning: empty node in callchain tree Warning: empty node in callchain tree Warning: empty node in callchain tree Warning: empty node in callchain tree Warning: empty node in callchain tree Warning: empty node in callchain tree Warning: empty node in callchain tree no symbols found in /usr/sbin/iscsid, maybe install a debug package? Warning: empty node in callchain tree Warning: empty node in callchain tree Warning: empty node in callchain tree Warning: empty node in callchain tree Warning: empty node in callchain tree Warning: empty node in callchain tree Warning: empty node in callchain tree Warning: empty node in callchain tree Warning: empty node in callchain tree Warning: empty node in callchain tree Warning: empty node in callchain tree Warning: empty node in callchain tree Warning: empty node in callchain tree Warning: empty node in callchain tree It seems there's a callchain problem. gdb bracktrace told me: $ gdb -q ./perf core.4513 Reading symbols from /home/namhyung/project/linux/tools/perf/perf...done. [New LWP 4514] [New LWP 4513] [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". Core was generated by `./perf top -G --stdio'. Program terminated with signal 11, Segmentation fault. #0 0x00000000004594ba in callchain_cursor_advance (cursor=) at util/callchain.h:141 141 cursor->curr = cursor->curr->next; Missing separate debuginfos, use: (gdb) bt #0 0x00000000004594ba in callchain_cursor_advance (cursor=) at util/callchain.h:141 #1 fill_node (cursor=0x19ad6f8, node=0x7f8208697df0) at util/callchain.c:226 #2 add_child (period=1198958, cursor=0x19ad6f8, parent=0x21197c0) at util/callchain.c:239 #3 append_chain_children (root=root@entry=0x21197c0, cursor=cursor@entry=0x19ad6f8, period=period@entry=1198958) at util/callchain.c:308 #4 0x000000000045951f in append_chain (period=1198958, cursor=0x19ad6f8, root=0x21197c0) at util/callchain.c:374 #5 append_chain_children (root=root@entry=0x1a25f90, cursor=cursor@entry=0x19ad6f8, period=1198958) at util/callchain.c:302 #6 0x0000000000459a33 in merge_chain_branch (cursor=cursor@entry=0x19ad6f8, dst=dst@entry=0x1a25f90, src=src@entry=0x28c3240) at util/callchain.c:415 #7 0x000000000045999a in merge_chain_branch (cursor=cursor@entry=0x19ad6f8, dst=dst@entry=0x1a25f90, src=src@entry=0x29e7480) at util/callchain.c:419 #8 0x000000000045a274 in callchain_merge (cursor=cursor@entry=0x19ad6f8, dst=dst@entry=0x1a25f88, src=src@entry=0x29e7478) at util/callchain.c:436 #9 0x00000000004776fe in hists__collapse_insert_entry (he=0x29e73d0, root=0x19ad540, hists=0x19ad520) at util/hist.c:401 #10 __hists__collapse_resort (hists=0x19ad520, threaded=threaded@entry=true) at util/hist.c:458 #11 0x00000000004791f1 in hists__collapse_resort_threaded (hists=) at util/hist.c:476 #12 0x0000000000426ad3 in perf_top__print_sym_table (top=0x7fffb70097c0) at builtin-top.c:309 #13 display_thread (arg=0x7fffb70097c0) at builtin-top.c:623 #14 0x0000003275607d14 in start_thread () from /lib64/libpthread.so.0 #15 0x00000032752f194d in clone () from /lib64/libc.so.6 (gdb) p *(struct callchain_cursor *)0x19ad6f8 $1 = {nr = 1, first = 0x1a097a0, last = 0x1a097b8, pos = 1, curr = 0x19c6a90} I wonder how callchain_cursor_advance() is called in fill_node() when cursor->pos == cursor->nr. It should be checked at while conditional and bailed out AFAICS. Any thought? Thanks, Namhyung