[PATCH 0/8] Enable Gen 7 Observation Architecture

Robert Bragg robert at sixbynine.org
Tue Feb 2 21:30:47 UTC 2016

This series enables support for the Observation Architecture on Haswell

Compared to the last series I sent out, the main changes are:

* The terminology changed so we open a 'stream' not an 'event'.

* A stream is configured with an array of u64 properties after finding
  the previous config struct quite awkward to validate and not well
  suited to supporting multiple kinds of streams sharing common config
  options (which arises with work Sourab Gupta is looking at based on
  this driver)

* No pre-defined enum of metric set IDs and metric sets are now
  advertised via sysfs. This is to allow for configs being loaded at
  runtime in the future and the use of uuids that can be unambiguously
  mapped to corresponding normalization equations in userspace. Another
  consideration here was that we might need to add new versions of a
  particular config like 'compute basic' (more likely for newer configs
  with less testing) at which point the enum doesn't really make life
  easier for userspace if you have to be aware of the versioning
  relationships and attempt different IDs to find the latest version the
  kernel supports.

I haven't written igt tests for this yet, but can hopefully start
looking at that next if there's no major issue with the general api. So
far the interface has been tested and iterated based on what's worked
out well for GPU Top[1], an implementation of GL_INTEL_performance_query
in Mesa and an implementation of an API called MDAPI used by GPA/VTune
to capture metrics (private a.t.m as I'm not sure there would be much
general interest in it.)

The PRM for Haswell's OA unit can be found here:


(though unfortunately it's not very complete documentation)

An example of opening an i915 perf stream can be seen in Mesa here:


A summary of the stream format can seen here:


There's an open issue to do with how to properly clear the status bits
in the OASTATUS1 register which I noticed the other day can't be right
a.t.m and I'm waiting for feedback on from the Windows team or OA
architect. I don't expect it will have much impact so it still seemed
worth sending this series now.

Another thing to mention is that I just noticed gputop is hitting the
cpu more than expected in its overview mode, polling for OA data and I
need to double check it's not a driver issue. Hopefully a minor issue;
probably not worth holding things up for.

Although this series only adds basic infrastructure and enables Haswell
it's probably good to keep in mind other work that builds on top. I've
also enabled Gen8+; there's some further work by Sourab Gupta to access
metrics in sync with command stream processing and Matthew Auld has
experimented with an interface for registering new OA configurations at

In case it's helpful to reference, the Gen 8 enabling can be seen here:

Sourab's work can be seen here:

Matt's patch for runtime configs can be seen here:

- Robert


Robert Bragg (8):
  drm/i915: Add i915 perf infrastructure
  drm/i915: rename OACONTROL GEN7_OACONTROL
  drm/i915: Add 'render basic' Haswell OA unit config
  drm/i915: Add i915 perf event for Haswell OA unit
  drm/i915: advertise available metrics via sysfs
  drm/i915: Add dev.i915.perf_event_paranoid sysctl option
  drm/i915: add oa_event_min_timer_exponent sysctl
  drm/i915: Add more Haswell OA metric sets

 drivers/gpu/drm/i915/Makefile           |    4 +
 drivers/gpu/drm/i915/i915_cmd_parser.c  |    4 +-
 drivers/gpu/drm/i915/i915_dma.c         |    7 +
 drivers/gpu/drm/i915/i915_drv.h         |  154 ++++
 drivers/gpu/drm/i915/i915_gem_context.c |   23 +-
 drivers/gpu/drm/i915/i915_oa_hsw.c      |  658 ++++++++++++++++
 drivers/gpu/drm/i915/i915_oa_hsw.h      |   38 +
 drivers/gpu/drm/i915/i915_perf.c        | 1283 +++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_reg.h         |  340 +++++++-
 include/uapi/drm/i915_drm.h             |  121 +++
 10 files changed, 2625 insertions(+), 7 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/i915_oa_hsw.c
 create mode 100644 drivers/gpu/drm/i915/i915_oa_hsw.h
 create mode 100644 drivers/gpu/drm/i915/i915_perf.c


More information about the dri-devel mailing list