Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4198967imm; Fri, 18 May 2018 00:40:13 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqA8rjQ1C+WWngSGg5fUbEVKg2yl3JpT/2Syvcv7nmBD1LE9tDGFc6YcIEEQH0FVrqULE6u X-Received: by 2002:a17:902:20e8:: with SMTP id v37-v6mr8318184plg.354.1526629213263; Fri, 18 May 2018 00:40:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526629213; cv=none; d=google.com; s=arc-20160816; b=Q6JBcq2GDC+awJH2r8t1fOpKH2UfLOyGQEPfFWldRUhbJkglr9hVpmHrHkDHQw67Wk avsGVZIrz0M2U5Zq0nPyEcIkrNxg/drEK9IvAZ+4J0f7zjPu4qqIQUtGeT99s3MYHiyq q/F8kIm1TXGrC7bEYWqLNsRmNN1CoiJdWh5woOTiND3pe1iGvn7NwvuicWcnRUXPr5j+ C9r1GoUw7hbukk4BNzSjZQJD3/4wNv7GLOBYuyX7Am0EBw8/Or219x5SuxVgtQYUHMDL 8gL3rQSeEYM14o0vqeJtSxNP769EWPPKPWzT3Eb5QDnJNbfsAglwpy/MMa3SpYI/OYDU YGSA== 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:references:cc:to:subject:from:arc-authentication-results; bh=7DJYe3omqhiH6aB8etESF3K3iDGNCQA7q2nsPWvYPSA=; b=d1rYNQG56CeO+cxodO9S0I3Tdmkna9hdzNEXq4iewC/q45B5XLy8BtWhvSPKF6/A/v P6VSg7OzjK1FjYoMfacF3EaJBAqi2WXDwMuxD+GzV7ArXESfxzrgP4+O2TJQMA37k3Ac WV93y5SSkFknKY94wZPmHlT6szKSIGp5YNxy0SmHQiwNbp5HwQeC4oBE/ih4+LO0SYWb qaGNLfT8GJh2cyVGW5jVEg5/R+gK0ttrDD0HQTiDjxPCJnLv2F9rJQhzsyXvII4Wu2wx umPFzijkVHOJvphh0wFy4ELwSPV3kJAub7TPPvn/E+cSoaWFnfASPJ9dmCtu0b4DvAN9 YOAw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h5-v6si5446947pgp.666.2018.05.18.00.39.58; Fri, 18 May 2018 00:40:13 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751994AbeERHjt (ORCPT + 99 others); Fri, 18 May 2018 03:39:49 -0400 Received: from mga02.intel.com ([134.134.136.20]:10669 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751023AbeERHjr (ORCPT ); Fri, 18 May 2018 03:39:47 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 May 2018 00:39:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,413,1520924400"; d="scan'208";a="50267879" Received: from linux.intel.com ([10.54.29.200]) by FMSMGA003.fm.intel.com with ESMTP; 18 May 2018 00:39:46 -0700 Received: from [10.125.252.18] (abudanko-mobl.ccr.corp.intel.com [10.125.252.18]) by linux.intel.com (Postfix) with ESMTP id 938FD5803FA; Fri, 18 May 2018 00:39:43 -0700 (PDT) From: Alexey Budankov Subject: Re: [PATCH v2]: perf/x86: store user space frame-pointer value on a sample To: Andy Lutomirski , Peter Zijlstra Cc: Andy Lutomirski , 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> <15a49a1c-01de-b904-a98b-ecced01b8ddb@linux.intel.com> Message-ID: <7bc35ce2-d936-a8bd-c14c-6cd270e2f98d@linux.intel.com> Date: Fri, 18 May 2018 10:39:42 +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: <15a49a1c-01de-b904-a98b-ecced01b8ddb@linux.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 16.05.2018 11:42, Alexey Budankov wrote: > Hi, > On 15.05.2018 19:30, Andy Lutomirski wrote: >> >>> On May 15, 2018, at 1:08 AM, Alexey Budankov wrote: >>> >>> >>> 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. >> >> Sorry, I missed this. Can you forward the original patch? I don’t have it. Just to make sure this and below didn't sneak out of your attention. > > 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. > */ > 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; >>> These days, system calls should save all registers, but I’m not entirely sure I want to promise that they’ll continue to do so forever. Thanks, Alexey