Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1666744

[PATCH 0/5] perf: add support for capturing skid IP

From Stephane Eranian <eranian@google.com>
Newsgroups linux.kernel
Subject [PATCH 0/5] perf: add support for capturing skid IP
Date 2017-06-15 16:00 +0200
Message-ID <tSDtv-39X-3@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Stephane Eranian (5):
  perf/core: add PERF_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              | 12 +++++++++++-
 tools/perf/perf.h                        |  1 +
 tools/perf/util/event.h                  |  1 +
 tools/perf/util/evsel.c                  | 11 ++++++++++-
 tools/perf/util/session.c                |  3 +++
 12 files changed, 65 insertions(+), 4 deletions(-)

-- 
2.13.1.518.g3df882009-goog

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 0/5] perf: add support for capturing skid IP Stephane Eranian <eranian@google.com> - 2017-06-15 16:00 +0200
  [PATCH 2/5] perf/x86: add PERF_SAMPLE_SKID_IP support for X86 PEBS Stephane Eranian <eranian@google.com> - 2017-06-15 16:00 +0200
    RE: [PATCH 2/5] perf/x86: add PERF_SAMPLE_SKID_IP support for X86  PEBS "Liang, Kan" <kan.liang@intel.com> - 2017-06-15 17:50 +0200
      Re: [PATCH 2/5] perf/x86: add PERF_SAMPLE_SKID_IP support for X86 PEBS Stephane Eranian <eranian@google.com> - 2017-06-15 18:40 +0200
        RE: [PATCH 2/5] perf/x86: add PERF_SAMPLE_SKID_IP support for X86  PEBS "Liang, Kan" <kan.liang@intel.com> - 2017-06-15 19:20 +0200
        Re: [PATCH 2/5] perf/x86: add PERF_SAMPLE_SKID_IP support for X86 PEBS Stephane Eranian <eranian@google.com> - 2017-06-15 21:20 +0200
  [PATCH 3/5] perf/tools: add support for PERF_SAMPLE_SKID_IP Stephane Eranian <eranian@google.com> - 2017-06-15 16:00 +0200
  [PATCH 4/5] perf/record: add support for sampling skid ip Stephane Eranian <eranian@google.com> - 2017-06-15 16:00 +0200
  Re: [PATCH 0/5] perf: add support for capturing skid IP Andi Kleen <ak@linux.intel.com> - 2017-06-15 17:20 +0200
    Re: [PATCH 0/5] perf: add support for capturing skid IP Stephane Eranian <eranian@google.com> - 2017-06-15 18:50 +0200
      Re: [PATCH 0/5] perf: add support for capturing skid IP Andi Kleen <ak@linux.intel.com> - 2017-06-15 19:30 +0200
        Re: [PATCH 0/5] perf: add support for capturing skid IP Stephane Eranian <eranian@google.com> - 2017-06-15 21:40 +0200
          Re: [PATCH 0/5] perf: add support for capturing skid IP Andi Kleen <ak@linux.intel.com> - 2017-06-15 22:10 +0200
            Re: [PATCH 0/5] perf: add support for capturing skid IP Stephane Eranian <eranian@google.com> - 2017-06-15 22:30 +0200
              Re: [PATCH 0/5] perf: add support for capturing skid IP Stephane Eranian <eranian@google.com> - 2017-06-16 00:30 +0200
                Re: [PATCH 0/5] perf: add support for capturing skid IP Andi Kleen <ak@linux.intel.com> - 2017-06-16 01:20 +0200
                Re: [PATCH 0/5] perf: add support for capturing skid IP Stephane Eranian <eranian@google.com> - 2017-06-16 09:00 +0200
                Re: [PATCH 0/5] perf: add support for capturing skid IP Andi Kleen <ak@linux.intel.com> - 2017-06-16 18:10 +0200
                Re: [PATCH 0/5] perf: add support for capturing skid IP Stephane Eranian <eranian@google.com> - 2017-06-16 19:10 +0200
                Re: [PATCH 0/5] perf: add support for capturing skid IP Stephane Eranian <eranian@google.com> - 2017-06-16 19:20 +0200
                Re: [PATCH 0/5] perf: add support for capturing skid IP Andi Kleen <ak@linux.intel.com> - 2017-06-16 20:00 +0200
                Re: [PATCH 0/5] perf: add support for capturing skid IP Stephane Eranian <eranian@google.com> - 2017-06-16 21:20 +0200

csiph-web