Received: by 10.192.165.148 with SMTP id m20csp4445346imm; Tue, 8 May 2018 08:33:55 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq5rZXMspBcWwuazU+JPsFpUPPI0PiSkplzswNTJ4VXd5ghLg+fes2hKXxUORLaetLMC06x X-Received: by 2002:a17:902:7487:: with SMTP id h7-v6mr41029545pll.154.1525793635021; Tue, 08 May 2018 08:33:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525793634; cv=none; d=google.com; s=arc-20160816; b=bxXYjqMX1HPsmNjfKAhQ1QdOyzAlY8ihamGjmf8X9IWpzWkNiQ9NcoQemxFHAzi80n h9rmJqiC98A2uaNcn1qLEPhC02IpOgDvBSqrYB4++pjS2TzCJ22CYWre35vlEI26UnKb Ys+uVSIV6OTFBMtqnhHHROwZLIvFsmGJxpw8W2K4gZocbjpxCTJCuI8KksP1OFCYH7Wa xbjYyHkss1ppyA7DbQIfR8Qkc7E89+WQSEjpchfUCUBu2VORMBZ+ox/Lt1GJvNkZaOM8 DX6iYp7qcIHmnN37wHKUF8tz2NgX8gu2GmBGbEn6abZWE8VfQMuvll2CQjpB4PUg3Qz2 1pFA== 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:mime-version:user-agent:date:message-id:subject :from:cc:to:arc-authentication-results; bh=e+fh/nlIfRc98/KYnP093L+OBJLXEa80H7/TmwSIDTA=; b=cupm32aM8Hg5D/GR31ZtWoVp7HthImAxnSoHBqIWqRh941ZjH8rBEqQJoscwSKW9nD 8sinyLuz57BsDQzRYd/w9UsMFWnGg9mfZOUwKxaCOfOyprf+hjUXHFYidBC8h7zmKBC6 nhsBX2M4XYOvhxJcbLwAUgty5beUCGaaOXvf7BjyLSHIvieRfZQbgdzgiVgUyXPVihol Q9rwpYcSdy/IeFySDQAOBmMslRtRQmDy36wV4OI2eQEoAdp3OhU2t+PdO6MAiq3fKvK3 AfXGffVB0HN/EipGA34/BIcZuCDTcG2AYbt/yjiLXuP4nSre+aPKBO06KEsOeyUwtAzr ghBA== 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 w16-v6si24380575plk.79.2018.05.08.08.33.40; Tue, 08 May 2018 08:33:54 -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 S932430AbeEHPVw (ORCPT + 99 others); Tue, 8 May 2018 11:21:52 -0400 Received: from mga01.intel.com ([192.55.52.88]:59291 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754632AbeEHPVu (ORCPT ); Tue, 8 May 2018 11:21:50 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 May 2018 08:21:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,378,1520924400"; d="scan'208";a="37761239" Received: from linux.intel.com ([10.54.29.200]) by fmsmga007.fm.intel.com with ESMTP; 08 May 2018 08:21:40 -0700 Received: from [10.125.252.142] (abudanko-mobl.ccr.corp.intel.com [10.125.252.142]) by linux.intel.com (Postfix) with ESMTP id 8DC67580322; Tue, 8 May 2018 08:21:38 -0700 (PDT) To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo Cc: Alexander Shishkin , Jiri Olsa , Namhyung Kim , Andi Kleen , linux-kernel , linux-perf-users@vger.kernel.org From: Alexey Budankov Subject: [PATCH v2]: perf/x86: store user space frame-pointer value on a sample Message-ID: <31205dc8-b756-e12b-0249-2ed06c2db9c9@linux.intel.com> Date: Tue, 8 May 2018 18:21:36 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 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 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;