[RFC v3 00/11] i915 PMU and engine busy stats

Tvrtko Ursulin
2017-09-11T15:26:08Z

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Third spin of the i915 PMU series.

In this version I integrated some of the changes Dmitry made after clarifying
the perf API usage questions with Peter Zijlstra. Some other changes I
integrated in spirit but changed the implementation, and then finally there
are some new fixups and tidies.

Patches 1-3 are small refactors to make the following work easier.

Patch 4 is the main bit.

Patch 5 is a small optimisation on top, to only run the sampling timer when it
is required. (Depending on GPU awake status and active PMU counters.)

Patches 6-7 add software engine busyness tracking, which is then used from the
PMU in patch 9. This allows more efficient and more accurate engine busyness
metric.

Patch 8 exposes the engine busyness in debugfs should anyone care to access it
that way.

Patch 10 was requested by Ben to provide the metrics to be used from outside
i915.

And finally patch 11 is an additional optimisation which hides the whole cost
of the software engine busyness tracking behind a single nop instruction in
the off case.

Strictly speaking, the series provides a fully functional PMU by patch 4. The
rest are optimisations, improvement and API exports.

I think what should follow is:

1. A final discussion on the ABI. Which counters do we want etc.
2. Another pass on the PMU implementation from the perf API point of view.

Assuming there are no big surprises after the two items above, the patches are
probably quite close to being ready for review and losing the RFC status.

Tvrtko Ursulin (11):
drm/i915: Convert intel_rc6_residency_us to ns
drm/i915: Add intel_energy_uJ
drm/i915: Extract intel_get_cagf
drm/i915/pmu: Expose a PMU interface for perf queries
drm/i915/pmu: Suspend sampling when GPU is idle
drm/i915: Wrap context schedule notification
drm/i915: Engine busy time tracking
drm/i915: Export engine busy stats in debugfs
drm/i915/pmu: Wire up engine busy stats to PMU
drm/i915: Export engine stats API to other users
drm/i915: Gate engine stats collection with a static key

drivers/gpu/drm/i915/Makefile | 1 +
drivers/gpu/drm/i915/i915_debugfs.c | 117 ++++-
drivers/gpu/drm/i915/i915_drv.c | 2 +
drivers/gpu/drm/i915/i915_drv.h | 95 +++-
drivers/gpu/drm/i915/i915_gem.c | 1 +
drivers/gpu/drm/i915/i915_gem_request.c | 1 +
drivers/gpu/drm/i915/i915_pmu.c | 806 ++++++++++++++++++++++++++++++++
drivers/gpu/drm/i915/i915_reg.h | 3 +
drivers/gpu/drm/i915/intel_engine_cs.c | 171 +++++++
drivers/gpu/drm/i915/intel_lrc.c | 19 +-
drivers/gpu/drm/i915/intel_pm.c | 62 ++-
drivers/gpu/drm/i915/intel_ringbuffer.c | 25 +
drivers/gpu/drm/i915/intel_ringbuffer.h | 132 ++++++
include/uapi/drm/i915_drm.h | 58 +++
14 files changed, 1452 insertions(+), 41 deletions(-)
create mode 100644 drivers/gpu/drm/i915/i915_pmu.c

--
2.9.5