Received: by 10.192.165.148 with SMTP id m20csp2272imm; Wed, 9 May 2018 07:57:01 -0700 (PDT) X-Google-Smtp-Source: AB8JxZppilpKjnP18PB6jQvX6CP8h4+Md5WYLD+fyctvz274RfuBbx2aZ/skC7QzXRCyHKrPhSLX X-Received: by 2002:a63:6307:: with SMTP id x7-v6mr4441756pgb.269.1525877821860; Wed, 09 May 2018 07:57:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525877821; cv=none; d=google.com; s=arc-20160816; b=kRBAq3mTZo31vli0p8ZcmFREnhjuc5a9I3Ofpl7eh3hyz2UI2NhlhgKldHpvLD0+iK KJFjtTWX3ohhhi4CrOejRKSRR+H9pdE7tEQMktgagnTHVXYWdm394R+gTpp+KfmtMbgG 8d7cIhCNi1Bd4awGEcWiPWb+EZnePYkrTcE3eF7Coq0ylntEO5AvH7DLFMqXRla5rUk+ uJbWjcWhXWyfVt2FpjnPjh4cwQpGCIQ/wbSRPpDh2CeId3WlHZyC68oiIJ7mtIAD25YY aH/2QkmjK77WwFO+IVLRUuoXehs3NL+b27hHadL+NnMk0ALSckGkq/obpGJRN8tF1a3j 75wA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=OYsPqPUArsUZetzHO1WbP8ynH5dBwPKdx2WzUvACCis=; b=Ycgb3ZUydstGMC6Er2AwpAn3ACkU8TcmSLTB8G0xWsNQqc2Ee7eAaO/zwZTsjIAhsb xtudTv/pvDpI+xMHQSfCm2dExs1TSxgx1gskxPKkamV+tgAMaAm/L/LB2hlseSNBj42Q I2KEzWJA6aT2KasI3UzghYLbzsFQBmtQF2EN6/FKqbH6zrMijLu2+WSdHBhLitiAXWrx CrT+VDnFtRdYSwQn+FIgBcbHDD3/xc3f69ZPG/Ywc1mRwGov/qcZt5YSFzxpek50+ZgS gMgk6X7uVIOwxI9E8CvX1Y+vYoL8HDhkMiWv3bTzrQRNWbGSP6ZuO/x/RX8kNfpQmtTN 7psw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=lzETX93v; 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 m3-v6si26676953pld.296.2018.05.09.07.56.35; Wed, 09 May 2018 07:57:01 -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; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=lzETX93v; 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 S935252AbeEIOyr (ORCPT + 99 others); Wed, 9 May 2018 10:54:47 -0400 Received: from merlin.infradead.org ([205.233.59.134]:56134 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934517AbeEIOyq (ORCPT ); Wed, 9 May 2018 10:54:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=OYsPqPUArsUZetzHO1WbP8ynH5dBwPKdx2WzUvACCis=; b=lzETX93vczANYeYxPrIk7PCWZ s6XsbJckDXHk+FbIJ2kqPcwpHHdXAfy3D89Z5C01Rs/lTCgg7shv61l6myhFszerp1leWyw8Lm7z0 KwgNI/LSKFVNlmcvaNFjkXpFaJCnEToNslzf87cNpPGnyvMN98l1lwASY44g7ZMfKR9/0ktSfcYqo hcFWq3Y9/WX1edClKSRMMFYeum4mCw1JKSMixPCWHYDXaopAc5bJTeSngY8sK4nJgQ72aBNmVwKxq wJFa+L4GlWmqM5mI2ZaGnoikjzQUYxKrLZjOZ4cJ1yRWdI5UOsn1+eQo7K/9hHI3BGpd8X8MdEL6r izyuOL+AA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fGQUH-0000P9-Hj; Wed, 09 May 2018 14:54:38 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 4ABC52029FA13; Wed, 9 May 2018 16:54:36 +0200 (CEST) Date: Wed, 9 May 2018 16:54:36 +0200 From: Peter Zijlstra To: Alexey Budankov Cc: Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Andi Kleen , linux-kernel , linux-perf-users@vger.kernel.org, Andy Lutomirski Subject: Re: [PATCH v2]: perf/x86: store user space frame-pointer value on a sample Message-ID: <20180509145436.GV12217@hirez.programming.kicks-ass.net> References: <31205dc8-b756-e12b-0249-2ed06c2db9c9@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <31205dc8-b756-e12b-0249-2ed06c2db9c9@linux.intel.com> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > */ > 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;