From patchwork Wed Jan 22 14:11:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Pihet X-Patchwork-Id: 3523361 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 7CFFA9F2E9 for ; Wed, 22 Jan 2014 14:14:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7A3E32013D for ; Wed, 22 Jan 2014 14:14:11 +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 4975620138 for ; Wed, 22 Jan 2014 14:14:10 +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 1W5yYK-0006kT-15; Wed, 22 Jan 2014 14:13:12 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W5yY3-0007bT-JQ; Wed, 22 Jan 2014 14:12:55 +0000 Received: from mail-ee0-f51.google.com ([74.125.83.51]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W5yXN-0007RO-Ir for linux-arm-kernel@lists.infradead.org; Wed, 22 Jan 2014 14:12:16 +0000 Received: by mail-ee0-f51.google.com with SMTP id b57so4912808eek.24 for ; Wed, 22 Jan 2014 06:11:42 -0800 (PST) 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=xPYZCsSdwNy71VmD/cGbC3eHqB0vHzxL69G0X9ZijRo=; b=lkio5Q8v9ww+dqXDZSnnBr/QsoZjntPCAxVz2Bhdlrg2bVRIs1HKnSSXZ8+C+hpomp y3xelZTKbMEhzmD70gYK2dthz82yo2spiDeIWUboJQZ7UCEmaauiAiuodxS/Fj4W3bG8 UCPhSXbQbgIxvd2irS6xWvlC44hLiCv7VZSOZgDt9r/FTyZ/FJLQZYv+CuGAznHrFmMl Bqqp0OAFtx5R4FcdkiGdX7RJ6UiQFAyRyOwwyW5EG7QK4bX4KMIAjlsO7bF16bf4NGN5 UvXdcQ5i1u65K+QJReqbQ49Rqvql5xj6s+LfarlwVAMZbiaZ6ohf+sXpoxDmZt36Pyqf 209g== X-Gm-Message-State: ALoCoQklyvhTJ6BGE0KWvoPyhaxjTfk3rilAXtKheMRR8CBqOSIwFg9/XMpR0dosfXvBBozFFXva X-Received: by 10.15.24.72 with SMTP id i48mr322276eeu.74.1390399901847; Wed, 22 Jan 2014 06:11:41 -0800 (PST) Received: from localhost.localdomain (80.58-241-81.adsl-dyn.isp.belgacom.be. [81.241.58.80]) by mx.google.com with ESMTPSA id d43sm27572324eeo.12.2014.01.22.06.11.39 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 22 Jan 2014 06:11:41 -0800 (PST) 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 , Will Deacon Subject: [PATCH 4/4] ARM64: perf: support dwarf unwinding in compat mode Date: Wed, 22 Jan 2014 15:11:19 +0100 Message-Id: <1390399879-5109-5-git-send-email-jean.pihet@linaro.org> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1390399879-5109-1-git-send-email-jean.pihet@linaro.org> References: <1390399879-5109-1-git-send-email-jean.pihet@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140122_091213_790733_37765B4B X-CRM114-Status: GOOD ( 13.60 ) X-Spam-Score: -2.6 (--) Cc: Jean Pihet , patches@linaro.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=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 Add support for unwinding using the dwarf information in compat mode. Using the correct user stack pointer allows perf to record the frames correctly in the native and compat modes. Note that although the dwarf frame unwinding works ok using libunwind in native mode (on ARMv7 & ARMv8), some changes are required to the libunwind code for the compat mode. Those changes are posted separately on the libunwind mailing list. Tested on ARMv8 platform with v8 and compat v7 binaries, the latter are statically built. Signed-off-by: Jean Pihet --- arch/arm64/include/asm/compat.h | 2 +- arch/arm64/include/asm/ptrace.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h index fda2704..e71f81f 100644 --- a/arch/arm64/include/asm/compat.h +++ b/arch/arm64/include/asm/compat.h @@ -228,7 +228,7 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr) return (u32)(unsigned long)uptr; } -#define compat_user_stack_pointer() (current_pt_regs()->compat_sp) +#define compat_user_stack_pointer() (user_stack_pointer(current_pt_regs())) static inline void __user *arch_compat_alloc_user_space(long len) { diff --git a/arch/arm64/include/asm/ptrace.h b/arch/arm64/include/asm/ptrace.h index fbb0020..86d5b54 100644 --- a/arch/arm64/include/asm/ptrace.h +++ b/arch/arm64/include/asm/ptrace.h @@ -133,7 +133,7 @@ struct pt_regs { (!((regs)->pstate & PSR_F_BIT)) #define user_stack_pointer(regs) \ - ((regs)->sp) + (!compat_user_mode(regs)) ? ((regs)->sp) : ((regs)->compat_sp) /* * Are the current registers suitable for user mode? (used to maintain