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: 3570341 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 281659F382 for ; Mon, 3 Feb 2014 18:21:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 62C8020160 for ; Mon, 3 Feb 2014 18:21:29 +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 6D7DA20142 for ; Mon, 3 Feb 2014 18:21:28 +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 1WAO7j-0006AK-T9; Mon, 03 Feb 2014 18:20:00 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WAO7J-0004AE-7l; Mon, 03 Feb 2014 18:19:33 +0000 Received: from mail-ea0-f182.google.com ([209.85.215.182]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WAO6z-00044J-2g for linux-arm-kernel@lists.infradead.org; Mon, 03 Feb 2014 18:19:15 +0000 Received: by mail-ea0-f182.google.com with SMTP id r15so3887120ead.41 for ; Mon, 03 Feb 2014 10:18:50 -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=CO6Zf9kyaHCRiQjHt7wqshdRpG/aAd06SAJtvMQ3UqY=; b=iZC61MWINwlKI9rHvsHhCx3bkex2UpjCoUTsk80EZG5RZXHFlizjBYkiKuvAMVH0m8 E/enMkWvlmdw8KHzSpSYTdaemZX2L0Up3YnB58/wRfyP35KjGp4j1fkrCuTzgH3ENCtP VbnZfOr79KqKI9nO0aRnT4F2YWzrsAjSPl7GNJ8CIrq80tZnN6sbSjc1HUDHlYun5boY BdhN2SXq2DyAzseLuUlfsJ+TcNilFXHW9+zILTSDkXcQ0wgeVYHXo6youV+OdELR6g8h TCoByoQqQ19G681mN75YA3MMXYQKH8dLFNn5OVFjPhq8zBmTRWexh2L3Ge8oi37QnJVH Jkkg== X-Gm-Message-State: ALoCoQnlgF97XXpscX2j12OrAzAYICvO/lYcgLGqA4Uoj1VGeD/mt2Fjs6MQKreaasMZlMKr9LGn 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 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140203_131913_415397_68F8FE9A X-CRM114-Status: GOOD ( 13.34 ) X-Spam-Score: -2.6 (--) Cc: Jean Pihet , Jiri Olsa , Ingo Molnar , Arnaldo , 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.7 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 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