Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752141AbdFLL6v (ORCPT ); Mon, 12 Jun 2017 07:58:51 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:47849 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751942AbdFLL6t (ORCPT ); Mon, 12 Jun 2017 07:58:49 -0400 Subject: Re: [PATCH v2] perf: libdw support for powerpc [ping] To: Paolo Bonzini References: <1496312681-20133-1-git-send-email-pbonzini@redhat.com> Cc: linux-kernel@vger.kernel.org, acme@kernel.org, "Naveen N. Rao" , linuxppc-dev@lists.ozlabs.org, mark@klomp.org From: Ravi Bangoria Date: Mon, 12 Jun 2017 17:28:37 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 17061211-2213-0000-0000-000001D94A5E X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007218; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000212; SDB=6.00873678; UDB=6.00434813; IPR=6.00653764; BA=6.00005412; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00015788; XFM=3.00000015; UTC=2017-06-12 11:58:47 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17061211-2214-0000-0000-000056791B79 Message-Id: <593E81ED.8060606@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-06-12_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1706120211 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 6615 Lines: 127 Hi Paolo, Thanks for the patch and really sorry for being late. I was quite busy with few other things. On Friday 09 June 2017 06:00 PM, Paolo Bonzini wrote: > > On 01/06/2017 12:24, Paolo Bonzini wrote: >> Porting PPC to libdw only needs an architecture-specific hook to move >> the register state from perf to libdw. >> >> The ARM and x86 architectures already use libdw, and it is useful to >> have as much common code for the unwinder as possible. Mark Wielaard >> has contributed a frame-based unwinder to libdw, so that unwinding works >> even for binaries that do not have CFI information. In addition, >> libunwind is always preferred to libdw by the build machinery so this >> cannot introduce regressions on machines that have both libunwind and >> libdw installed. >> >> Cc: acme@kernel.org >> Cc: Naveen N. Rao >> Cc: Ravi Bangoria >> Cc: linuxppc-dev@lists.ozlabs.org >> Signed-off-by: Paolo Bonzini >> --- >> v1->v2: fix for 4.11->4.12 changes > Ravi, Naveen, any reviews? So, I tested this patch along with Mark's patch[1] on elfutils an looks like it's not working. Steps on what I did: After applying Mark's patch on upstream elfutils: $ aclocal $ autoheader $ autoconf $ automake --add-missing $ ./configure $ make $ make install DESTDIR=/home/ravi/elfutils-git After applying your patch on upstream perf: $ make $ ./perf record --call-graph=dwarf ls $ LD_LIBRARY_PATH=/home/ravi/elfutils-git/usr/local/lib:\ /home/ravi/elfutils-git/usr/local/lib/elfutils/:$LD_LIBRARY_PATH \ ./perf script ls 44159 1800.878468: 191408 cycles:u: ls 44159 1800.878673: 419356 cycles:u: 8a97c hpte_need_flush (/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux) 835f4 flush_hash_page (/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux) 8acec hpte_need_flush (/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux) 3468f4 ptep_clear_flush (/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux) 328b10 wp_page_copy (/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux) 32ebe4 do_wp_page (/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux) 33434c __handle_mm_fault (/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux) 335040 handle_mm_fault (/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux) 7bf94 do_page_fault (/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux) 1a4f8 handle_page_fault (/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux) ls 44159 1800.878961: 430876 cycles:u: ls 44159 1800.879195: 423785 cycles:u: ls 44159 1800.879360: 427359 cycles:u: Here I don't see userspace callchain getting unwound. Please let me know if I'm doing anything wrong. Same perf.data with libunwind: ls 44159 1800.878468: 191408 cycles:u: 20380 _dl_sysdep_start (/usr/lib64/ld-2.17.so) 1c7f _dl_start_final (/usr/lib64/ld-2.17.so) 5ce7 _dl_start (/usr/lib64/ld-2.17.so) 1937 _start (/usr/lib64/ld-2.17.so) ls 44159 1800.878673: 419356 cycles:u: 8a97c hpte_need_flush (/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux) 835f4 flush_hash_page (/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux) 8acec hpte_need_flush (/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux) 3468f4 ptep_clear_flush (/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux) 328b10 wp_page_copy (/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux) 32ebe4 do_wp_page (/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux) 33434c __handle_mm_fault (/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux) 335040 handle_mm_fault (/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux) 7bf94 do_page_fault (/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux) 1a4f8 handle_page_fault (/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux) 7cd4 _dl_map_object_from_fd (/usr/lib64/ld-2.17.so) b24b _dl_map_object (/usr/lib64/ld-2.17.so) 12b3b openaux (/usr/lib64/ld-2.17.so) 159bf _dl_catch_error (/usr/lib64/ld-2.17.so) 13323 _dl_map_object_deps (/usr/lib64/ld-2.17.so) 3feb dl_main (/usr/lib64/ld-2.17.so) 2045b _dl_sysdep_start (/usr/lib64/ld-2.17.so) 1c7f _dl_start_final (/usr/lib64/ld-2.17.so) 5ce7 _dl_start (/usr/lib64/ld-2.17.so) 1937 _start (/usr/lib64/ld-2.17.so) ls 44159 1800.878961: 430876 cycles:u: dcb8 check_match.10245 (/usr/lib64/ld-2.17.so) e55b do_lookup_x (/usr/lib64/ld-2.17.so) e8d7 _dl_lookup_symbol_x (/usr/lib64/ld-2.17.so) 10493 _dl_relocate_object (/usr/lib64/ld-2.17.so) 4cf7 dl_main (/usr/lib64/ld-2.17.so) 2045b _dl_sysdep_start (/usr/lib64/ld-2.17.so) 1c7f _dl_start_final (/usr/lib64/ld-2.17.so) 5ce7 _dl_start (/usr/lib64/ld-2.17.so) 1937 _start (/usr/lib64/ld-2.17.so) ls 44159 1800.879195: 423785 cycles:u: 960a0 malloc (/usr/lib64/libc-2.17.so) 32a53 _nl_intern_locale_data (/usr/lib64/libc-2.17.so) 3337f _nl_load_locale_from_archive (/usr/lib64/libc-2.17.so) 323b3 _nl_find_locale (/usr/lib64/libc-2.17.so) 31b93 setlocale (/usr/lib64/libc-2.17.so) 2a8b _init (/usr/bin/ls) 2497f generic_start_main.isra.0 (/usr/lib64/libc-2.17.so) 24b73 __libc_start_main (/usr/lib64/libc-2.17.so) ls 44159 1800.879360: 427359 cycles:u: a42b8 get_next_seq (/usr/lib64/libc-2.17.so) a54ff __strcoll_l (/usr/lib64/libc-2.17.so) [1] https://sourceware.org/ml/elfutils-devel/2017-q2/msg00223.html