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: 23528 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f72.google.com (mail-oa0-f72.google.com [209.85.219.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 66051218CB for ; Wed, 22 Jan 2014 14:11:44 +0000 (UTC) Received: by mail-oa0-f72.google.com with SMTP id i4sf1550555oah.3 for ; Wed, 22 Jan 2014 06:11:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=xPYZCsSdwNy71VmD/cGbC3eHqB0vHzxL69G0X9ZijRo=; b=m21/NgOyiu5o2z8WDMh0ul34maw0QA6vlY3jUqFzvVoarnz4mTlTKajg6vJR/aqEgi z4YMx/NOqR2/ja99NSZhvXNU9bGnWALJKAB3HrbI2bzcxjmaFOmbq+ke+XmOPIzqBNc2 WOHwkmfuiENhnlLDw3arbaGICsjKoBSxuYWGnuKIqCQV0qm87q5XSKiBFxHVnGRIb4jo GSbf7Hlmiwkx3XSZWYrUVzx/eJax8Lsm/YvmF37+NJaqVgO6NAUc9VEf/qb6uNn92orX 1DzfyUancc+bTUjAOE+jby5fNvcOra2/orKYWJbh0WDj4VP4qh8smKZ9CzmvSpQPFbhO 5Uow== X-Gm-Message-State: ALoCoQkGdJGdqL3VGiYYOR+0/w4EooWqJwOOaMI+Q8Wj8N5mo41oV6OQslK1j2jZihWBBojhs3H2 X-Received: by 10.182.66.137 with SMTP id f9mr626280obt.3.1390399903370; Wed, 22 Jan 2014 06:11:43 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.2.8 with SMTP id 8ls63751qeq.79.gmail; Wed, 22 Jan 2014 06:11:43 -0800 (PST) X-Received: by 10.221.55.8 with SMTP id vw8mr1087318vcb.8.1390399903289; Wed, 22 Jan 2014 06:11:43 -0800 (PST) Received: from mail-vb0-f51.google.com (mail-vb0-f51.google.com [209.85.212.51]) by mx.google.com with ESMTPS id ja16si4606277vec.88.2014.01.22.06.11.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 22 Jan 2014 06:11:43 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.51 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.51; Received: by mail-vb0-f51.google.com with SMTP id 11so240747vbe.10 for ; Wed, 22 Jan 2014 06:11:43 -0800 (PST) X-Received: by 10.58.4.138 with SMTP id k10mr1081255vek.8.1390399903204; Wed, 22 Jan 2014 06:11:43 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp187102vcz; Wed, 22 Jan 2014 06:11:42 -0800 (PST) X-Received: by 10.14.100.204 with SMTP id z52mr1716884eef.68.1390399902330; Wed, 22 Jan 2014 06:11:42 -0800 (PST) Received: from mail-ee0-f51.google.com (mail-ee0-f51.google.com [74.125.83.51]) by mx.google.com with ESMTPS id y5si10680653eee.249.2014.01.22.06.11.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 22 Jan 2014 06:11:42 -0800 (PST) Received-SPF: neutral (google.com: 74.125.83.51 is neither permitted nor denied by best guess record for domain of jean.pihet@linaro.org) client-ip=74.125.83.51; Received: by mail-ee0-f51.google.com with SMTP id b57so4946321eek.10 for ; Wed, 22 Jan 2014 06:11:41 -0800 (PST) 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 Cc: patches@linaro.org, Jean Pihet 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-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: jean.pihet@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.51 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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