From patchwork Wed Mar 19 09:42:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Pihet X-Patchwork-Id: 3850331 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 51AFC9F370 for ; Wed, 19 Mar 2014 09:45:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A4CAD2034E for ; Wed, 19 Mar 2014 09:44:59 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B26D22013D for ; Wed, 19 Mar 2014 09:44:54 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WQD2X-0005XK-Gy; Wed, 19 Mar 2014 09:44:02 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WQD2L-0004Yd-68; Wed, 19 Mar 2014 09:43:49 +0000 Received: from mail-ee0-f53.google.com ([74.125.83.53]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WQD1s-0004U2-Fx for linux-arm-kernel@lists.infradead.org; Wed, 19 Mar 2014 09:43:27 +0000 Received: by mail-ee0-f53.google.com with SMTP id b57so5660202eek.26 for ; Wed, 19 Mar 2014 02:42:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=jt5orT8PhfvvW1MCihbb3/TrraDCY54zvDmXFJhPoVA=; b=QfjVat5EbOgFRbg6mH9dFOSuTGaVIcxK9EZMEJytaX/zii9qa8CTp4xZOtUMwNh8Y5 naYg6+KSksmBm2zhzIQHiwDBVOCnm5Nr6MwuqaxhOywZKuJVwOiZHh23SYUQKWonRWZd Myi80XmTJK2Uq1S9+OJKM+2qjdDkGA0k+tvfyszXOaExI3I0nNYCDsLyTTowDuGouv1/ 3sWbW4pzep2OYNL8Gm7WYN/NzOFG0BOl6gpN71v5hbL2Qy9Yc+UNqma3y7jKbdMREh11 fIIBhhZcy8Vm0C6dDbZJeVrjw7z2XKnU5ceZutpOcRv/yXqpsHvCFrc6AD7rdRYQn1rf OxXg== X-Gm-Message-State: ALoCoQkn9N+gSvQamhQ5XnRNP8sJaADkFwYlAf9eG3748/U2ewVgabtbVRN8BglMp1KM/kTgv5Yp X-Received: by 10.15.21.2 with SMTP id c2mr19788353eeu.78.1395222176317; Wed, 19 Mar 2014 02:42:56 -0700 (PDT) Received: from localhost.localdomain (90.102-241-81.adsl-dyn.isp.belgacom.be. [81.241.102.90]) by mx.google.com with ESMTPSA id n5sm3004316eex.14.2014.03.19.02.42.54 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 19 Mar 2014 02:42:55 -0700 (PDT) From: Jean Pihet To: "linux-kernel@vger.kernel.org" , "linaro-kernel@lists.linaro.org" , "linux-arm-kernel@lists.infradead.org" , Arnaldo , Ingo Molnar , Jiri Olsa , Steve Capper , Mark Rutland Subject: [PATCH 3/3] perf tools: Add libdw DWARF post unwind support for ARM64 Date: Wed, 19 Mar 2014 10:42:35 +0100 Message-Id: <1395222155-22205-4-git-send-email-jean.pihet@linaro.org> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1395222155-22205-1-git-send-email-jean.pihet@linaro.org> References: <1395222155-22205-1-git-send-email-jean.pihet@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140319_054320_643551_C963AFA1 X-CRM114-Status: GOOD ( 12.68 ) X-Spam-Score: -0.9 (/) Cc: Peter Zijlstra , Corey Ashford , Frederic Weisbecker , patches@linaro.org, Paul Mackerras , David Ahern , Namhyung Kim , Jean Pihet X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY, URIBL_BLACK autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Adding libdw DWARF post unwind support, which is part of elfutils-devel/libdw-dev package from version 0.158. Note: the libdw code needs some support for dwarf unwinding on ARM64, this code is submitted seperately on the elfutils ML. The new code is contained in unwin-libdw.c object, and implements unwind__get_entries unwind interface function. Signed-off-by: Jean Pihet Cc: Jiri Olsa Cc: Corey Ashford Cc: Frederic Weisbecker Cc: Ingo Molnar Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Arnaldo Carvalho de Melo Cc: David Ahern --- tools/perf/arch/arm64/Makefile | 5 +++ tools/perf/arch/arm64/util/unwind-libdw.c | 53 +++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 tools/perf/arch/arm64/util/unwind-libdw.c diff --git a/tools/perf/arch/arm64/Makefile b/tools/perf/arch/arm64/Makefile index 221f21d..09d6215 100644 --- a/tools/perf/arch/arm64/Makefile +++ b/tools/perf/arch/arm64/Makefile @@ -4,6 +4,11 @@ LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o endif ifndef NO_LIBUNWIND LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libunwind.o +endif +ifndef NO_LIBDW_DWARF_UNWIND +LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libdw.o +endif +ifndef NO_DWARF_UNWIND LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/regs_load.o LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/dwarf-unwind.o endif diff --git a/tools/perf/arch/arm64/util/unwind-libdw.c b/tools/perf/arch/arm64/util/unwind-libdw.c new file mode 100644 index 0000000..8d24958 --- /dev/null +++ b/tools/perf/arch/arm64/util/unwind-libdw.c @@ -0,0 +1,53 @@ +#include +#include "../../util/unwind-libdw.h" +#include "../../util/perf_regs.h" + +bool libdw__arch_set_initial_registers(Dwfl_Thread *thread, void *arg) +{ + struct unwind_info *ui = arg; + struct regs_dump *user_regs = &ui->sample->user_regs; + Dwarf_Word dwarf_regs[PERF_REG_ARM64_MAX]; + +#define REG(r) ({ \ + Dwarf_Word val = 0; \ + perf_reg_value(&val, user_regs, PERF_REG_ARM64_##r); \ + val; \ +}) + + dwarf_regs[0] = REG(X0); + dwarf_regs[1] = REG(X1); + dwarf_regs[2] = REG(X2); + dwarf_regs[3] = REG(X3); + dwarf_regs[4] = REG(X4); + dwarf_regs[5] = REG(X5); + dwarf_regs[6] = REG(X6); + dwarf_regs[7] = REG(X7); + dwarf_regs[8] = REG(X8); + dwarf_regs[9] = REG(X9); + dwarf_regs[10] = REG(X10); + dwarf_regs[11] = REG(X11); + dwarf_regs[12] = REG(X12); + dwarf_regs[13] = REG(X13); + dwarf_regs[14] = REG(X14); + dwarf_regs[15] = REG(X15); + dwarf_regs[16] = REG(X16); + dwarf_regs[17] = REG(X17); + dwarf_regs[18] = REG(X18); + dwarf_regs[19] = REG(X19); + dwarf_regs[20] = REG(X20); + dwarf_regs[21] = REG(X21); + dwarf_regs[22] = REG(X22); + dwarf_regs[23] = REG(X23); + dwarf_regs[24] = REG(X24); + dwarf_regs[25] = REG(X25); + dwarf_regs[26] = REG(X26); + dwarf_regs[27] = REG(X27); + dwarf_regs[28] = REG(X28); + dwarf_regs[29] = REG(X29); + dwarf_regs[30] = REG(LR); + dwarf_regs[31] = REG(SP); + dwarf_regs[32] = REG(PC); + + return dwfl_thread_state_registers(thread, 0, PERF_REG_ARM64_MAX, + dwarf_regs); +}