Received: by 10.223.164.202 with SMTP id h10csp607772wrb; Wed, 8 Nov 2017 23:58:25 -0800 (PST) X-Google-Smtp-Source: ABhQp+R5ZeaIlCdyXsYWWrFh9WyQkL7cyEpeEi7w/LMBYTHvZ5lu5Yc2PjbV/O4uYz3Z8FZdXwHq X-Received: by 10.159.207.134 with SMTP id z6mr3079054plo.144.1510214305122; Wed, 08 Nov 2017 23:58:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510214305; cv=none; d=google.com; s=arc-20160816; b=eU+qit8StZiFS1K3njonet/8dSTtIL7c8VmWMSQrSvEq+Qf+rrIsZFk5VojUdpP6Du jQrz+55Zeosb7iypAIhEUVIklS8qTGumzEP1j6xLJuJJXWnelfHUjb+ZtO4hatkAGltI mPcOaNHk3qOwdAnBZUJRp6Djfh+u+12jAkuMdSxNE5sydwKM/KaJQ2AnAuJlIBq2e90j DRSU0LeBJshGRoufFiO9nKQ7VxrxzvP9ezNMBjfAu1rlmkZ3AIlEnHvRpP0F/FEjaoaY mrV+br9Qe20E+HETM13MUy11+hGm/XzQFxT0Kdj3ar0qTJjOzll1U4cS6hp5fO+Eu+YD Hqeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=1ER5Eu/vAPiP4Bi37q1EZgF4tniP7vOCmFXZ7Dj/ljo=; b=X5iswbwKAj10kJPa3hyUcHp1QgFLEsaeBgXYFwAUSWfkXdBY1bHNfh/yM06XSRg4us 915ZGyAeX8RPzKzL3uyb5BZglbmZ5HNoapzQHIC+GlbD5oTu5e3fOslmRXVfcj1aE93Y OYpqRyQxMminnSjdScNIYSLdX4ojJ4gQU2a7xz4ioUdBxWg7VsM8Pa4LLIhd2YsdGBSz 9Ecz/b6hdrVhzu1t4gU/D5U9x7Q8LtaQOQVBHMO2HpZfEBM9L1sol+3XIdIja2uA37Qe 4/1SZ+YBMsPTMEUJESbOnIpMxCRiCPEXXdw6xy7zd7E6obcboa+lKmSRbM5jie6xPuxS rUgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=TNxVdSWg; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a25si5838246pff.55.2017.11.08.23.58.13; Wed, 08 Nov 2017 23:58:25 -0800 (PST) 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=pass header.i=@google.com header.s=20161025 header.b=TNxVdSWg; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753157AbdKIH5X (ORCPT + 82 others); Thu, 9 Nov 2017 02:57:23 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:53421 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753110AbdKIH5U (ORCPT ); Thu, 9 Nov 2017 02:57:20 -0500 Received: by mail-pf0-f193.google.com with SMTP id b6so3473702pff.10 for ; Wed, 08 Nov 2017 23:57:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=1ER5Eu/vAPiP4Bi37q1EZgF4tniP7vOCmFXZ7Dj/ljo=; b=TNxVdSWg7Yovj4S3FMCqGueWIKrfzBzwOeXZq6LhfTeDoFnrP5AKuyXUYmioyexFeo SJnHwWNGXqlMWY9ZgML8tDOBXQS5otrtsAQGnu+8etfzBSurYK07TzYnSRxHElrbvza1 Dzo4XKaPQK9jIwzPEH85qjveJeHnZpiN9k2xSDJRUZPPAO2jjPezJVfr/Z+gubJwfBjr 1PJb1wrkEZDuLrLuewIA2AvM9qAug5VM16n0O09i1hXKt3IYAQTCl5pBzlcWw9jwipLe DE9wmO10PUHp/P7Ozo5/VES/s1O4DZA4jbLqyqbTbekPJApVxcsoSqj9gyCPwsLSS4FX UpaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=1ER5Eu/vAPiP4Bi37q1EZgF4tniP7vOCmFXZ7Dj/ljo=; b=ayTqCDydrBcYyl0rIrgNAwOfljqFJOg6hvXdENKciqwbJCFeCSliBrxvhXrlsqcwNh GKAnLeCytG20mtTij4n+RKzGdVqX1fqoC4lhbWFBhKDTcaaziLfdqgxwnGEvGWgcXsvA +6Xsm+SPEgwXSYGKlRqLvGD2B8F3mofi2CoUq40z9xIzUxU6Qfwa5GGBGfJ/mD8V6qEx 7pAjH45lZOyTux+MsuxXnfTXh8wrDTUIGCqY655mA/Y+rVUXmABRzQgYQ7m1Tt6bgRte Mdw9gOKvYc++o5S4/fHovs8sy1vJbn7xYGXjsZasjlHJ/qqiPZajRerDuLF7PXnWu2YD Wj/Q== X-Gm-Message-State: AJaThX4yTwMZOTZgnIjtydvXrVB8vaESKGChduW5E30Yz3vWioIuYjOa xiPf02s+pXhQLv9GIAR5tt4RGyiv5E0= X-Received: by 10.98.60.198 with SMTP id b67mr3242888pfk.163.1510214239428; Wed, 08 Nov 2017 23:57:19 -0800 (PST) Received: from localhost ([172.56.39.30]) by smtp.gmail.com with ESMTPSA id t25sm10122717pfh.67.2017.11.08.23.57.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Nov 2017 23:57:17 -0800 (PST) From: Stephane Eranian To: linux-kernel@vger.kernel.org Cc: acme@redhat.com, peterz@infradead.org, mingo@elte.hu, ak@linux.intel.com, kan.liang@intel.com, jolsa@redhat.com Subject: [PATCH v4 0/5] perf: add support for capturing skid IP Date: Wed, 8 Nov 2017 23:57:08 -0800 Message-Id: <1510214233-2074-1-git-send-email-eranian@google.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patchs adds a new sample record type called PERF_SAMPLE_SKID_IP. The goal is to record the unmodified interrupted instruction pointer (IP) as seen by the kernel and reflected in the machine state. On some architectures, it is possible to avoid the IP skid using hardware support. For instance, on Intel x86, the use of PEBS helps eliminate the skid on Haswell and later processors. On older Intel processor, software, i.e., the kernel, may succeed in eliminating the skid. Without this patch, on Haswell processors, if you set: - attr.precise = 0, then you get the skid IP - attr.precise = 1, then you get the skid PEBS ip (off-by-1) - attr.precise = 2, then you get the skidless PEBS ip The IP is captured when the event has PERF_SAMPLE_IP set in sample_type. However, there are certain measurements where you need to have BOTH the skidless IP and the skid IP. For instance, when studying branches, the skid IP usually points to the target of the branch while the skidless IP points to the branch instruction itself. Today, it is not possible to retrieve both at the same time. This patch makes this possible by specifying PERF_SAMPLE_IP|PERF_SAMPLE_SKID_IP. As an example, consider the following code snipet: 37.51 42c2ed je 42c2f3 42c2ef add $0x1,%rdx 42c2f3 sub $0x1,%rax When using PEBS (precise=2) and sampling on BR_INST_RETIRED.CONDITIONAL, the IP always points to 0x42c2ed. With precise=1, the IP would point to 0x42c2f3. It is interesting to collect both IPs in a single run to determine how often the conditional branch is taken vs. non-taken. Understanding the skid is also interesting for other precise events. In V2, we rebased to 10d94ff4d558 (v4.14-rc7). In V3, code is rebased to 4.14-rc8, LKML comments have been integrated. The new way to specify skid ip is per event: $ perf record -e cpu/event=0xc5,skid-ip=1/ .... In V4, we fix document of the ski-ip event option and move a session.c change to the correct patch as per Jiri's remark. Stephane Eranian (5): perf/core: add PERF_RECORD_SAMPLE_SKID_IP record type perf/x86: add PERF_SAMPLE_SKID_IP support for X86 PEBS perf/tools: add support for PERF_SAMPLE_SKID_IP perf/record: add documentation for using PERF_SAMPLE_SKID_IP perf/script: add support for PERF_SAMPLE_SKID_IP arch/x86/events/intel/ds.c | 7 +++++++ include/linux/perf_event.h | 2 ++ include/uapi/linux/perf_event.h | 4 +++- kernel/events/core.c | 14 ++++++++++++++ tools/include/uapi/linux/perf_event.h | 4 +++- tools/perf/Documentation/perf-record.txt | 8 ++++++++ tools/perf/Documentation/perf-script.txt | 2 +- tools/perf/builtin-script.c | 10 ++++++++-- tools/perf/util/event.h | 1 + tools/perf/util/evsel.c | 11 +++++++++++ tools/perf/util/evsel.h | 2 ++ tools/perf/util/parse-events.c | 7 +++++++ tools/perf/util/parse-events.h | 1 + tools/perf/util/parse-events.l | 1 + tools/perf/util/session.c | 3 +++ 15 files changed, 72 insertions(+), 5 deletions(-) -- 2.7.4 From 1583495184409837486@xxx Wed Nov 08 10:58:07 +0000 2017 X-GM-THRID: 1583495184409837486 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread