Received: by 10.223.164.202 with SMTP id h10csp1198493wrb; Tue, 7 Nov 2017 23:58:17 -0800 (PST) X-Google-Smtp-Source: ABhQp+TGHFwiJfU1dQgOsEc5ZRU4fmSCn+wkGQOodkANwhJTPtWmGC8JU37MFc0KL/sJGixfxJFh X-Received: by 10.159.235.150 with SMTP id f22mr1413880plr.416.1510127897237; Tue, 07 Nov 2017 23:58:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510127897; cv=none; d=google.com; s=arc-20160816; b=d5IzKgB6ASzlQyutd13IJA/fFeK83rvgnn5JWQ1y2NFnDH77lI10qn+ZO8vzBijvbG shmqgK843pmnpKcWbNOdMogA9aM6+EWzys5/nLkVknQRke9ELIf4q96oy6qByOvMKTJW OXlJxXVGJpwDmVXSqZcUr0d63PX1uUoWZ8Q1RDnk/Pj1cfWEl7fel7hKwSUUHoXMSAdZ 7PVhz0DkTTeeoAXuD2SC90tSDeeB0cjxWMsv6PIfH4WJAdOPW0fazJO1allH4kz2eb0I WC5afpjSx1Suw9QCpFlJqdrpeCz9kZUASlRkM5MBOzrP/WgBvfoAR070dmKlhKpAZlR8 /Zww== 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=gnM44HdmCICFPmR5RXuFJ5HZMzVKPIG1CI+tfHuOvh4=; b=HYkfL8h8sA0zv2S2PUTUMX2TiUKiRe2Rbr+ag/K1sFVKvSz49w4CF1peRED9I6yMYx E1rlLZAkTFR907IPUxMs06vCecF2UOGk/5OUq+x0dsYmoShJyIAUC+DiMMbHoSpB67w0 GnwBIKB1gqpc5WQMuidhDMW2FnILNvKgUICLMIhpn0CXa2yM9y1NNp2YKF5wXrgU0QC1 MXly22IN+w/74bbF9UZF4tHRyV663A512RKId4iOFXef3ruyljDu9weLPqzpOwIzqcHc Rjxb/R+65+WhFKPQh8Hn7NJ/Sgm/EPlmUSbaHZjNb17xrESUJ8GYDJrW+eyEILWtggSJ 7QkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=oVGdJusl; 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 n10si2975540plk.132.2017.11.07.23.58.04; Tue, 07 Nov 2017 23:58:17 -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=oVGdJusl; 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 S1751241AbdKHH4x (ORCPT + 89 others); Wed, 8 Nov 2017 02:56:53 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:56117 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750760AbdKHH4q (ORCPT ); Wed, 8 Nov 2017 02:56:46 -0500 Received: by mail-pf0-f195.google.com with SMTP id 17so1191575pfn.12 for ; Tue, 07 Nov 2017 23:56:45 -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=gnM44HdmCICFPmR5RXuFJ5HZMzVKPIG1CI+tfHuOvh4=; b=oVGdJusl2awyaTEGj6CTBJdxKalqS0ZLMmNZ5Iqj++SSbN5cPNQSMFE8Wf4uhmV4lL rVXFoc+7BhR7T+CNw3XcFEGNWu/KCV/GekgnouzO6pp9h/MznPu6beBbgohHXc19JEy2 T/m4jLZGWC0Jl6qw9MVlqIjts0pZWkMw3BlPEi5ANlNpqTbO7IV9QzEih2X1TcVAl+UF 2hR0MHMG3KsrQQZ1Lgkwmr7HXQdv1Rv+otR37XWPG7KPaET7xS/difq+3jdVi2VyZO1p ZxQGOZa6kDZgsQgMvONmqsbbC3ZLV8oS7E8JSGFnfhBBTbYv71hcUWLa/V+bwfsdPywA wfaQ== 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=gnM44HdmCICFPmR5RXuFJ5HZMzVKPIG1CI+tfHuOvh4=; b=DFGaNhn7OdTwZwwT3OTBsEtfp+ReVxBF06iIWN8lM4d9MEQ1eLMnfqMCALajXQl8ak NatDJCD/aj0qUQtxLQ+wE/vHIIGhHXKRzJmwF6VHBfqw2YFM9gzmt9/jpH35OeTmnqje KDD5BS0vlSpigeLjvVkzL1RM+BCDCzDpAlbGSfxAvQ9afmGiWj8zWhtyy26hr9mH4ekK CpFI0XBJ+p25+MRE2bQiETWYJ9xIil8KD9AqShCSC5PR0URH5w0gBpwa6/lM501jCYzi 6BfPC2E+atwhlZBmCrb+qzq4ELiH1YvUrDP55i6xsc5/yIlRp5CW1tYUav/p0tGkFgjA 1vIw== X-Gm-Message-State: AJaThX5aSS86UYiOHCzhG/1Khc9tpjhmu/m4ta6I5l3o9j71nOM2RuS1 tsDgLzYRCzVdbj2OwUJlC2XeOxyiNg8= X-Received: by 10.98.34.79 with SMTP id i76mr1646374pfi.42.1510127805000; Tue, 07 Nov 2017 23:56:45 -0800 (PST) Received: from localhost (c-67-169-55-77.hsd1.ca.comcast.net. [67.169.55.77]) by smtp.gmail.com with ESMTPSA id r22sm7362735pfl.15.2017.11.07.23.56.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Nov 2017 23:56:43 -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 v3 0/5] perf: add support for capturing skid IP Date: Tue, 7 Nov 2017 23:56:32 -0800 Message-Id: <1510127797-22483-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/ .... 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 sampling skid ip perf/script: add support for 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 1583504282160511558@xxx Wed Nov 08 13:22:43 +0000 2017 X-GM-THRID: 1583462782445245590 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread