Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp268625imm; Tue, 15 May 2018 01:10:18 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpSqfC3fGAkQgJoGDi1U1q+mpbRiqfTF2KdmvxfbJu2AeyhAamAb5Czaufzfcr2DG7E5rpa X-Received: by 2002:a63:18a:: with SMTP id 132-v6mr9941130pgb.344.1526371818475; Tue, 15 May 2018 01:10:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526371818; cv=none; d=google.com; s=arc-20160816; b=tmLa9h/fVMPUTMTAQJN43shBzhVEP6agsuZedZYPlAqkRVnbGCTIg7DMtSdaPQOQP8 AezMx0q0cq8dSRKvxhGW4r67GJZkKtAXp2NqgemBoZK7ww6SGdaojTYvu5CHQGENf+1d rDuRkwmELOvAvoMklv23TPzLgYzVlxag88DUVCAPwFUJit8tUPOICWnMgp8MowOwrsQ7 KX5VcgnMRPkMmtXMxTmZ6J8gLAN7yy8lwh6tfugEcHeeevirM7HtD8OdKSkOZXNFF4I3 KXAEGNucpPaxr1IsuIPTu4S88gNUR5tTdSLzbeIlZe1wsRLEERpjltcpkjwwVjgeCmhv Cotw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=DOn4BSeNh8cJpKEe6Hai8mfZUOYO2GzIetOcZQen4sY=; b=r/WVc5w7cSAG5fZuoQFOq0gTH52vhv/rziMNyWbqi7H5cOWGvtgpDxNFRtb20eypq8 7RV19DrjSmFkCSt5Z6bON0oy0V2nU5hrxfDGU6yFWJwYEZSBnjTZQBA0lkIXeD8PHHdJ Icvn413zWEfXNC2um/7SgozcpEww8bLiyb3r2ur+d5rGK3Nqf52jKsDhuTyI4aAR69rH /wtq5HlnjFMA8XP1wShz1axLdfoq79/RsmPes2Obm2ke/0cWcutJ7T5jb+k9KrMlF5m3 sItZELHOwXG+iddG/YLW77Gf1R8aI6m+uEab43p+hGtKjCpgHCa2P/Yo6Ws5yj4D9Z/1 tyww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p67-v6si11053750pfp.72.2018.05.15.01.10.04; Tue, 15 May 2018 01:10:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752592AbeEOIJJ (ORCPT + 99 others); Tue, 15 May 2018 04:09:09 -0400 Received: from mga06.intel.com ([134.134.136.31]:28000 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752556AbeEOIJD (ORCPT ); Tue, 15 May 2018 04:09:03 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 May 2018 01:09:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,403,1520924400"; d="scan'208";a="41032299" Received: from linux.intel.com ([10.54.29.200]) by orsmga007.jf.intel.com with ESMTP; 15 May 2018 01:09:02 -0700 Received: from [10.125.252.219] (unknown [10.125.252.219]) by linux.intel.com (Postfix) with ESMTP id 5D0825800A4; Tue, 15 May 2018 01:09:00 -0700 (PDT) Subject: Re: [PATCH v2]: perf/x86: store user space frame-pointer value on a sample To: Peter Zijlstra , Andy Lutomirski Cc: Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Andi Kleen , linux-kernel , linux-perf-users@vger.kernel.org References: <31205dc8-b756-e12b-0249-2ed06c2db9c9@linux.intel.com> <20180509145436.GV12217@hirez.programming.kicks-ass.net> From: Alexey Budankov Message-ID: Date: Tue, 15 May 2018 11:08:59 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180509145436.GV12217@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andy, On 09.05.2018 17:54, Peter Zijlstra wrote: > On Tue, May 08, 2018 at 06:21:36PM +0300, Alexey Budankov wrote: >> >> Store user space frame-pointer value (BP register) into Perf trace >> on a sample for a process so the value becomes available when >> unwinding call stacks for functions gaining event samples. >> >> Signed-off-by: Alexey Budankov >> --- >> arch/x86/kernel/perf_regs.c | 8 +++++++- >> 1 file changed, 7 insertions(+), 1 deletion(-) >> >> diff --git a/arch/x86/kernel/perf_regs.c b/arch/x86/kernel/perf_regs.c >> index e47b2dbbdef3..8d68658eff7f 100644 >> --- a/arch/x86/kernel/perf_regs.c >> +++ b/arch/x86/kernel/perf_regs.c >> @@ -156,7 +156,13 @@ void perf_get_regs_user(struct perf_regs *regs_user, > > >> * Most system calls don't save these registers, don't report them. > > ^^^ that worries me and is the reason for the '-1's below. However I > think with all the PTI rework this might no longer be true. > > The Changelog needs to state that user_regs->bp is in fact valid and > ideally point to the commits that makes it so. Also this patch should > update that comment. > > Cc Andy who keeps better track of all that than me. Are there any thoughts so far? Feedback on the matter above is highly appreciated. Thanks, Alexey > >> */ >> regs_user_copy->bx = -1; >> - regs_user_copy->bp = -1; >> + /* >> + * Store user space frame-pointer value on sample >> + * to facilitate stack unwinding for cases when >> + * user space executable code has such support >> + * enabled at compile time; >> + */ >> + regs_user_copy->bp = user_regs->bp; >> regs_user_copy->r12 = -1; >> regs_user_copy->r13 = -1; >> regs_user_copy->r14 = -1; >