drm/i915/tracepoints: Add request submit and execute tracepoints
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>
Tue, 21 Feb 2017 11:01:42 +0000 (11:01 +0000)
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>
Tue, 21 Feb 2017 13:18:14 +0000 (13:18 +0000)
These new tracepoints are emitted once the request is ready to
be submitted to the GPU and once the request is about to
be submitted to the GPU, respectively.

Former condition triggers as soon as all the fences and
dependencies have been resolved, and the latter once the
backend is about to submit it to the GPU.

New tracepoint are enabled via the new
DRM_I915_LOW_LEVEL_TRACEPOINTS Kconfig option which is disabled
by default to alleviate the performance impact concerns.

v2: Move execute tracepoint to __i915_gem_request_submit.
    (Chris Wilson)

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
drivers/gpu/drm/i915/Kconfig.debug
drivers/gpu/drm/i915/i915_gem_request.c
drivers/gpu/drm/i915/i915_trace.h

index 68ff072f8b764c08dae6aebe35c9abcb23b610c6..e091809a9a9ecb227b1194cf81e06b5f5fd061ae 100644 (file)
@@ -76,3 +76,14 @@ config DRM_I915_SELFTEST
          Recommended for driver developers only.
 
          If in doubt, say "N".
+
+config DRM_I915_LOW_LEVEL_TRACEPOINTS
+        bool "Enable low level request tracing events"
+        depends on DRM_I915
+        default n
+        help
+          Choose this option to turn on low level request tracing events.
+          This provides the ability to precisely monitor engine utilisation
+          and also analyze the request dependency resolving timeline.
+
+          If in doubt, say "N".
index 543cef57972bfd5fde1604ccdc8ff4ce137ad493..12b06e05549020b1e1d1c39ad105879c828aaf91 100644 (file)
@@ -426,6 +426,7 @@ void __i915_gem_request_submit(struct drm_i915_gem_request *request)
        spin_unlock(&request->timeline->lock);
 
        i915_sw_fence_commit(&request->execute);
+       trace_i915_gem_request_execute(request);
 }
 
 void i915_gem_request_submit(struct drm_i915_gem_request *request)
@@ -449,6 +450,7 @@ submit_notify(struct i915_sw_fence *fence, enum i915_sw_fence_notify state)
 
        switch (state) {
        case FENCE_COMPLETE:
+               trace_i915_gem_request_submit(request);
                request->engine->submit_request(request);
                break;
 
index 85accea70b4df9790a2a8390d9b47adc98cfd0c9..e3c0f9e94488eaae264003322093604f8f0c9c90 100644 (file)
@@ -477,6 +477,30 @@ DEFINE_EVENT(i915_gem_request, i915_gem_request_add,
            TP_ARGS(req)
 );
 
+#if defined(CONFIG_DRM_I915_LOW_LEVEL_TRACEPOINTS)
+DEFINE_EVENT(i915_gem_request, i915_gem_request_submit,
+            TP_PROTO(struct drm_i915_gem_request *req),
+            TP_ARGS(req)
+);
+
+DEFINE_EVENT(i915_gem_request, i915_gem_request_execute,
+            TP_PROTO(struct drm_i915_gem_request *req),
+            TP_ARGS(req)
+);
+#else
+#if !defined(TRACE_HEADER_MULTI_READ)
+static inline void
+trace_i915_gem_request_submit(struct drm_i915_gem_request *req)
+{
+}
+
+static inline void
+trace_i915_gem_request_execute(struct drm_i915_gem_request *req)
+{
+}
+#endif
+#endif
+
 TRACE_EVENT(i915_gem_request_notify,
            TP_PROTO(struct intel_engine_cs *engine),
            TP_ARGS(engine),