From patchwork Mon Feb 3 18:18:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Pihet X-Patchwork-Id: 24062 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f72.google.com (mail-qa0-f72.google.com [209.85.216.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0E6B1202B2 for ; Mon, 3 Feb 2014 18:18:52 +0000 (UTC) Received: by mail-qa0-f72.google.com with SMTP id f11sf17883990qae.11 for ; Mon, 03 Feb 2014 10:18:52 -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=CO6Zf9kyaHCRiQjHt7wqshdRpG/aAd06SAJtvMQ3UqY=; b=mUv0/kXKMBNxoRFY2oEOSznJ4OnvkY2iAAtkmu7rDU/+u5YB9jkt/jwzYT8wtZr6BR XAfDtrdxF+DMS6vBcFE77amTq/Je81YhLrZ19FzqXpWkX3fcmS+gkMj8AMlce1zv4MdL mkXT1xQiNFjTQbvEL4qR+0E5+aRYfbr6FPR2SW39WMns258EnZiOmYZVBPf0eEPL0yvu 43yjWSoR0X4cUSKSkM6eht8mpRMyIOe47tzouRsKIagpgqX3HdQ3vF32jTW0tGEgGlAs QC6OdgAkP7yISiwckC0UXrDtKbDEItOBhnvK22aM5XAYdruxe772GhA1XecSit4SLTeR 6AbQ== X-Gm-Message-State: ALoCoQm8uRGtXyEKhYgBvOuNuPmqazMKf6iBOkYIe78yjgE4SlSlXUbUmy8WJ2c894zmvNCTeqoA X-Received: by 10.58.46.172 with SMTP id w12mr13321436vem.24.1391451532235; Mon, 03 Feb 2014 10:18:52 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.44.102 with SMTP id f93ls2009059qga.75.gmail; Mon, 03 Feb 2014 10:18:52 -0800 (PST) X-Received: by 10.52.117.115 with SMTP id kd19mr24617386vdb.15.1391451532107; Mon, 03 Feb 2014 10:18:52 -0800 (PST) Received: from mail-ve0-f170.google.com (mail-ve0-f170.google.com [209.85.128.170]) by mx.google.com with ESMTPS id er6si7055681vdc.75.2014.02.03.10.18.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 03 Feb 2014 10:18:52 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.170; Received: by mail-ve0-f170.google.com with SMTP id cz12so5345379veb.1 for ; Mon, 03 Feb 2014 10:18:52 -0800 (PST) X-Received: by 10.52.163.65 with SMTP id yg1mr25120385vdb.14.1391451532037; Mon, 03 Feb 2014 10:18:52 -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 u4csp174321vcz; Mon, 3 Feb 2014 10:18:51 -0800 (PST) X-Received: by 10.14.201.66 with SMTP id a42mr4354074eeo.97.1391451530762; Mon, 03 Feb 2014 10:18:50 -0800 (PST) Received: from mail-ea0-f170.google.com (mail-ea0-f170.google.com [209.85.215.170]) by mx.google.com with ESMTPS id s6si37113730eel.224.2014.02.03.10.18.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 03 Feb 2014 10:18:50 -0800 (PST) Received-SPF: neutral (google.com: 209.85.215.170 is neither permitted nor denied by best guess record for domain of jean.pihet@linaro.org) client-ip=209.85.215.170; Received: by mail-ea0-f170.google.com with SMTP id k10so3935608eaj.29 for ; Mon, 03 Feb 2014 10:18:50 -0800 (PST) X-Received: by 10.14.225.67 with SMTP id y43mr16039130eep.10.1391451530336; Mon, 03 Feb 2014 10:18:50 -0800 (PST) Received: from localhost.localdomain (193.52-245-81.adsl-dyn.isp.belgacom.be. [81.245.52.193]) by mx.google.com with ESMTPSA id k41sm67692577een.19.2014.02.03.10.18.46 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 03 Feb 2014 10:18:49 -0800 (PST) From: Jean Pihet To: linux-kernel@vger.kernel.org, linaro-kernel@lists.linaro.org, linux-arm-kernel@lists.infradead.org, Will Deacon Cc: Arnaldo , Ingo Molnar , Jiri Olsa , patches@linaro.org, Jean Pihet Subject: [PATCH 3/3] ARM64: perf: support dwarf unwinding in compat mode Date: Mon, 3 Feb 2014 19:18:29 +0100 Message-Id: <1391451509-31265-4-git-send-email-jean.pihet@linaro.org> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1391451509-31265-1-git-send-email-jean.pihet@linaro.org> References: <1391451509-31265-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.128.170 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 Acked-by: Will Deacon --- 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