Received: by 10.223.164.221 with SMTP id h29csp2463439wrb; Thu, 2 Nov 2017 11:19:11 -0700 (PDT) X-Google-Smtp-Source: ABhQp+RlEbQCQP+JKr8HiOm2PhTzm1Me/Ww/fYD15gbn2l3+2UTMKJ/aQ0qQ452bR5+yUKCL4vEP X-Received: by 10.99.8.5 with SMTP id 5mr4518969pgi.28.1509646751065; Thu, 02 Nov 2017 11:19:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509646751; cv=none; d=google.com; s=arc-20160816; b=WyvYNjYDLtf5TcJ2gDNAkcA3HIBp51SDp2A4DBiZ6KEzBjXdJDsaZdZpPhFnt8NHeA kd3jNwiJoeUvbxxk+g8jVUfzYTCYKT6+ndCf6GmKXeyPtPDhxTy4ArSDFKpc7dikV9fO /oGS1p0IdR39pxS6Mux0BYEjAlVVvYKj61QapJaZlBME5whSULzx8utD85pWA8ieObsQ UqXBbqM9s4lnEzN3mjESEL+YtGxN5DaNDheCOGtPB3EX+wr3g/0pWD5ZPoIFNjMgikq0 rnZK0nfn+GLT8BVhZT3Rdy4NrHw81HMSVkEUtYPWVj04reYNsBTyrUuk8R4vLjRTgBxs /noQ== 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=3iDxesvkFQxQPMUtRbvY4VYujpq38TOeew1q/3TDbh8=; b=fF2Wjjq2xzgY9yWfwJ9LHe7phRq5m1Z4gr4GuEtiQ/PWHYALalBE+dikckhOHSX3Bh OQPjW7+2seue4Wg15G1BthfwhDbVNQkz82tS/8XBKHSNokG1TQ6Z5K2QR2imbQnp7+eC W5E6/sYyOb3XmMVJ+5cQlfa1TzWxdJL/tC6+jfENiE1g10TNWQh0rbelTNufP7gw7P0K 9pdAlhUzR3Kl3pGqVdcGhY/kiWd5RpKaIGsfvV64dg2qKpPqCxfvUFfyHuWVwZo8VEjA Y212TTNuS4zPOC+2v9HWvwn7lR+FWECsb9xaEFhMvgEtWB0PcUyUb5MY9Iq6WtiBzFSH 8Xhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=SKLcI6+q; 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 h15si4169322pgf.32.2017.11.02.11.18.57; Thu, 02 Nov 2017 11:19:11 -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=pass header.i=@google.com header.s=20161025 header.b=SKLcI6+q; 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 S933566AbdKBSQD (ORCPT + 97 others); Thu, 2 Nov 2017 14:16:03 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:47412 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932438AbdKBSQC (ORCPT ); Thu, 2 Nov 2017 14:16:02 -0400 Received: by mail-pg0-f66.google.com with SMTP id r25so313804pgn.4 for ; Thu, 02 Nov 2017 11:16:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=3iDxesvkFQxQPMUtRbvY4VYujpq38TOeew1q/3TDbh8=; b=SKLcI6+qhQEAzibwDRwzuY13oE76mR41HSwCspY124T3hOVlXJ1oOl0UIXpJfOW+CP xikVnqJ0uoIDf9/BXuTIcfgRYraeW4ZsT3C2YOKvk8yQ5MkC9VQb0TSx/xYh5PRyoKsg XVil3Ywu08lQvR0KI+lNMhCRodKa8kp0q5tZVssX2jdKdu0Yj0CisaoByKB4fgabRAfv FSsSGdTWaxAqwULjYoDzto1v+vNBFDQjAuGlRlthTQVoglWAdO3/BLK1hGk8wEbV1ytp zFo3MbwuzWJsTqRcocQ9i2cq5NH6LGFOn/o/LRqKGGKmcmkrzrIIfPzTgufcwJbXim2K kjEQ== 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=3iDxesvkFQxQPMUtRbvY4VYujpq38TOeew1q/3TDbh8=; b=CajfP4nCDSQ70sE+A55+wtFoFmX78RaIkwwJmklP3vu+tLi2hMlqmEmi4NyljTXxj9 2Id4xr2LPPNWWQ5x5ev4kX388NBQU+fk8hvX1yXtIMrhp64Oi1diYhRlLVpX/exTMiE4 tyR78k/Q0JNudVAWODJqQOkseqRh0fGx1sAulw4wLhw/43l3a1p8EuOgPnVWzHiYe8SP LOWVORaIw5ZNf/e8Oxc16UUu8WsQF2wcINuenhgDwmJuBJlrzCkMtfhyWuNArlY1czYV 6uW2ZMMqqLaHR4FTzwJX2BwwrXyPlSts1kVGKbldhD5Z19PEA7mAIqBvfWlPbmyd3Ite 4v7g== X-Gm-Message-State: AMCzsaVKlxQMazGljJet0NoxWW8Qkixm5DYJiAUvsecli7dyV+qsSNIm 3zdTaQNbcNP0OvOlO7JqfHIfyAAD2zA= X-Received: by 10.84.128.195 with SMTP id a61mr4097010pla.283.1509646561517; Thu, 02 Nov 2017 11:16:01 -0700 (PDT) Received: from localhost (c-67-169-55-77.hsd1.ca.comcast.net. [67.169.55.77]) by smtp.gmail.com with ESMTPSA id z89sm7140360pff.21.2017.11.02.11.16.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Nov 2017 11:16:00 -0700 (PDT) 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 v2 0/5] perf: add support for capturing skid IP Date: Thu, 2 Nov 2017 11:15:54 -0700 Message-Id: <1509646559-919-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). 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 support 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/builtin-record.c | 2 ++ tools/perf/builtin-script.c | 6 ++++++ tools/perf/perf.h | 1 + tools/perf/util/event.h | 1 + tools/perf/util/evsel.c | 10 ++++++++++ tools/perf/util/session.c | 3 +++ 12 files changed, 60 insertions(+), 2 deletions(-) -- 2.7.4 From 1589602324806603749@xxx Sun Jan 14 20:48:30 +0000 2018 X-GM-THRID: 1582987891472235339 X-Gmail-Labels: Inbox,Category Forums,Downloaded_2018-01