From patchwork Tue May 6 15:55:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Pihet X-Patchwork-Id: 4122781 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 24CA6C0ACC for ; Tue, 6 May 2014 15:58:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 44FE22022A for ; Tue, 6 May 2014 15:58:27 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (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 557C92024C for ; Tue, 6 May 2014 15:58:26 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WhhjS-00041x-O1; Tue, 06 May 2014 15:56:38 +0000 Received: from mail-ee0-f44.google.com ([74.125.83.44]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Whhj6-0003QO-2h for linux-arm-kernel@lists.infradead.org; Tue, 06 May 2014 15:56:16 +0000 Received: by mail-ee0-f44.google.com with SMTP id c41so6509276eek.31 for ; Tue, 06 May 2014 08:55:54 -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=sliCH4cSXBQ50EAq5CZNqS/ohcaJv4U2u7R5ZJX8uG4=; b=kmlyz1LOH/dkfWMFxyxBNn0yZgJEwhFyAMU4OorcmgKDXakUyf7hkUFgcosEdY+wyE WlTTOMMWbi8mLxXeq3pceBDXlwgsb/tVm89jplV0862u0uASJY0+wTP9nK89fgHT/H7E DLfDEqadklj8cmZtjT0ePR8xbI/lXb3qq5Vm2RkuTsRV3bvjWPWitZK5oMAeM7AVTCMl zI89q692ckQ4aTWk8iW37NiD5YYnsymB3m6YJ7cJBzqjwvs5BG8ROCl8JzVW9+8MwkmT fqm+e3G0FUb5QkydWo2+kklCNrTffw4zdww5q+abbA4u6R9iis+luUAjqt9hDGjBJ5Mo kCuQ== X-Gm-Message-State: ALoCoQkGPSu58I98QCb9RoCei7Gl3DcoNeFc1CQL6L1tpefireJILpUdwfUrZaTRl8tZmBbd+6jM X-Received: by 10.14.214.67 with SMTP id b43mr592029eep.14.1399391754032; Tue, 06 May 2014 08:55:54 -0700 (PDT) Received: from localhost.localdomain (193.219-240-81.adsl-dyn.isp.belgacom.be. [81.240.219.193]) by mx.google.com with ESMTPSA id x45sm39543683eef.15.2014.05.06.08.55.52 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 06 May 2014 08:55:53 -0700 (PDT) From: Jean Pihet To: Jiri Olsa , Arnaldo Carvalho de Melo , will.deacon@arm.com Subject: [PATCH 3/3] perf tools: Add libdw DWARF post unwind support for ARM64 Date: Tue, 6 May 2014 17:55:33 +0200 Message-Id: <1399391733-11927-4-git-send-email-jean.pihet@linaro.org> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1399391733-11927-1-git-send-email-jean.pihet@linaro.org> References: <1399391733-11927-1-git-send-email-jean.pihet@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140506_085616_291942_12BB5BC0 X-CRM114-Status: GOOD ( 13.29 ) X-Spam-Score: -0.7 (/) Cc: "linaro-kernel@lists.linaro.org" , Peter Zijlstra , Corey Ashford , Frederic Weisbecker , "linux-kernel@vger.kernel.org" , Paul Mackerras , David Ahern , Namhyung Kim , Jean Pihet , Ingo Molnar , "linux-arm-kernel@lists.infradead.org" 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,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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); +}