From patchwork Thu Jan 16 10:45:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Pihet X-Patchwork-Id: 3497871 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 7EA82C02DC for ; Thu, 16 Jan 2014 10:46:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8106720172 for ; Thu, 16 Jan 2014 10:46:32 +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 5F0DB20114 for ; Thu, 16 Jan 2014 10:46:31 +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 1W3kSs-0004yd-Rp; Thu, 16 Jan 2014 10:46:22 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W3kSq-000236-Fi; Thu, 16 Jan 2014 10:46:20 +0000 Received: from mail-we0-f170.google.com ([74.125.82.170]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W3kSn-00022E-Aq for linux-arm-kernel@lists.infradead.org; Thu, 16 Jan 2014 10:46:17 +0000 Received: by mail-we0-f170.google.com with SMTP id u57so3022396wes.15 for ; Thu, 16 Jan 2014 02:45:55 -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; bh=2JULUcBfneki2ACm9qVl/NRawCbLxmdL0rbjSRDZMz0=; b=N1Sh5u8SE4aLxqMDDPmyI9viF3gotjkuVNApHBCdmqVkh+79J2fU1iWCj2ckIZKWRF HcKvhqxUn6yU1jJLiaJr7T9Ky+B5x1yj1G9mWFbVmLQ+aT4rp9yfuO5IBnaDW5spmuHq xbeTyx51GHmwVUDGbIQwggcQP89s2PgXiAg5Z4aL4tBw5Zf2C4XBiPo4UJmVxHVZH72K faGZegFcOgowuD/50452mOrJaF9+FHg0G27fMfkO4A1cWLgLCgwBfHFUtNaZjhoM3IqE m8Gs4IRHGelSbU2c6F8HsYZL1q3yf/mjZjOjiA7SJGi1Uog3AD1SlPKMZVaHAdHt5l0+ UxtQ== X-Gm-Message-State: ALoCoQlgzjHDsJZo0MwVnJo/b+N0sN6J29KXOW2/8tyZk3FBOhfZf7420i7TMAzTFM91A+Z/Z9me X-Received: by 10.180.104.164 with SMTP id gf4mr7153950wib.35.1389869154998; Thu, 16 Jan 2014 02:45:54 -0800 (PST) Received: from localhost.localdomain ([81.241.7.250]) by mx.google.com with ESMTPSA id ey3sm32948590wib.4.2014.01.16.02.45.53 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 16 Jan 2014 02:45:53 -0800 (PST) From: Jean Pihet To: linux-kernel@vger.kernel.org, linaro-kernel@lists.linaro.org, linux-arm-kernel@lists.infradead.org, Will Deacon , Arnaldo Subject: [PATCH] ARM64: perf: support dwarf unwinding in compat mode Date: Thu, 16 Jan 2014 11:45:23 +0100 Message-Id: <1389869123-5884-1-git-send-email-jean.pihet@linaro.org> X-Mailer: git-send-email 1.7.11.7 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140116_054617_463013_86B3520B X-CRM114-Status: GOOD ( 12.15 ) X-Spam-Score: -2.6 (--) Cc: Jean Pihet , Jiri Olsa , Ingo Molnar , 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.5 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/ptrace.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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