From patchwork Thu Jan 16 12:26:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Pihet X-Patchwork-Id: 3498161 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 DB3929F2E9 for ; Thu, 16 Jan 2014 12:28:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CF59E2015E for ; Thu, 16 Jan 2014 12:27:59 +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 AC6DE20122 for ; Thu, 16 Jan 2014 12:27:58 +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 1W3m2k-0001gl-TR; Thu, 16 Jan 2014 12:27:31 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W3m2Z-00042B-2S; Thu, 16 Jan 2014 12:27:19 +0000 Received: from mail-ve0-f176.google.com ([209.85.128.176]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W3m2W-000409-35 for linux-arm-kernel@lists.infradead.org; Thu, 16 Jan 2014 12:27:17 +0000 Received: by mail-ve0-f176.google.com with SMTP id jy13so939760veb.21 for ; Thu, 16 Jan 2014 04:26:53 -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:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=Ww4Soujxe5e7g/DOiCgohT3SfEfxr0mi1bcfQYtE71E=; b=TnatAWIPYdVZLYES+WzfL37kVG24FHLZWyCv7rzT9aWcn7VKp2RiUIgu/SPbaKbo8M vnfmOyEmb/EVeu2VWd+TwaAL4LgpSsH4DqPJnSTFYGOe8JRtn8RmLVtjHn5uHscRJowF 6vYkx53x+xvu+pca2BsQ4s7+34ocDOHZKZnS5nbE539kSVkMn1e9dnPU8Ar9CgdwB2AZ RDGrCMDBptBUjowf4+E+mTZkvo2A0dmUFgNsbym8+AHbSpEymefvJswREiC4M0NVAVRu zOsGnDzaOTmpPGicQkCEzjQ8nqAfP+rxAwlXj6QjZkHsnLEbHzR3lKbODrvOz/T1iV7A tDWg== X-Gm-Message-State: ALoCoQmdzI/RyhvDqrAJhLM43W9KC5R5kgXsfomRcWky4JR3YiWl1y0yE9CZE0ZO3Bda4muh/Y5Q MIME-Version: 1.0 X-Received: by 10.58.181.230 with SMTP id dz6mr18354vec.35.1389875213762; Thu, 16 Jan 2014 04:26:53 -0800 (PST) Received: by 10.58.100.79 with HTTP; Thu, 16 Jan 2014 04:26:53 -0800 (PST) In-Reply-To: <20140116115634.GE30257@mudshark.cambridge.arm.com> References: <1389869123-5884-1-git-send-email-jean.pihet@linaro.org> <20140116115634.GE30257@mudshark.cambridge.arm.com> Date: Thu, 16 Jan 2014 13:26:53 +0100 Message-ID: Subject: Re: [PATCH] ARM64: perf: support dwarf unwinding in compat mode From: Jean Pihet To: Will Deacon X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140116_072716_171286_844E9C8F X-CRM114-Status: GOOD ( 17.43 ) X-Spam-Score: -2.6 (--) Cc: "linaro-kernel@lists.linaro.org" , "patches@linaro.org" , "linux-kernel@vger.kernel.org" , Arnaldo , Jiri Olsa , Ingo Molnar , "linux-arm-kernel@lists.infradead.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: , 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 On 16 January 2014 12:56, Will Deacon wrote: > Hi Jean, > > On Thu, Jan 16, 2014 at 10:45:23AM +0000, Jean Pihet wrote: >> 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. > > I guess it makes sense to include this with your earlier series adding > support for compat backtracing? > >> 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) > > In your previous series, compat backtracing is actually split out into a > separate function (compat_user_backtrace), so it would be more consistent to > have a compat_user_stack_pointer macro, rather than add this check here. Do you mean this change instead? If so let me prepare/test and re-submit this. Thx! Jean > > Will diff --git a/kernel/events/internal.h b/kernel/events/internal.h index 569b2187..9b88d2e 100644 --- a/kernel/events/internal.h +++ b/kernel/events/internal.h @@ -185,7 +185,8 @@ static inline bool arch_perf_have_user_stack_dump(void) return true; } -#define perf_user_stack_pointer(regs) user_stack_pointer(regs) +#define perf_user_stack_pointer(regs) \ + (!compat_user_mode(regs)) ? ((regs)->sp) : ((regs)->compat_sp) #else static inline bool arch_perf_have_user_stack_dump(void) {