Commit d7d96833 authored by Tvrtko Ursulin's avatar Tvrtko Ursulin

drm/i915/tracepoints: Add backend level request in and out tracepoints

Two new tracepoints placed at the call sites where requests are
actually passed to the GPU enable userspace to track engine
utilisation.

These tracepoints are only enabled when the
DRM_I915_LOW_LEVEL_TRACEPOINTS Kconfig option is enabled.

v2: Fix compilation with !CONFIG_DRM_I915_LOW_LEVEL_TRACEPOINTS.

v3: Name global seqno consistently across tracepoints.

v4: Remove port info from request out tracepoint. (Chris Wilson)
Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
parent dffabc8f
...@@ -518,6 +518,8 @@ static void __i915_guc_submit(struct drm_i915_gem_request *rq) ...@@ -518,6 +518,8 @@ static void __i915_guc_submit(struct drm_i915_gem_request *rq)
if (i915_vma_is_map_and_fenceable(rq->ring->vma)) if (i915_vma_is_map_and_fenceable(rq->ring->vma))
POSTING_READ_FW(GUC_STATUS); POSTING_READ_FW(GUC_STATUS);
trace_i915_gem_request_in(rq, 0);
b_ret = guc_ring_doorbell(client); b_ret = guc_ring_doorbell(client);
client->submissions[engine_id] += 1; client->submissions[engine_id] += 1;
......
...@@ -487,6 +487,45 @@ DEFINE_EVENT(i915_gem_request, i915_gem_request_execute, ...@@ -487,6 +487,45 @@ DEFINE_EVENT(i915_gem_request, i915_gem_request_execute,
TP_PROTO(struct drm_i915_gem_request *req), TP_PROTO(struct drm_i915_gem_request *req),
TP_ARGS(req) TP_ARGS(req)
); );
DECLARE_EVENT_CLASS(i915_gem_request_hw,
TP_PROTO(struct drm_i915_gem_request *req,
unsigned int port),
TP_ARGS(req, port),
TP_STRUCT__entry(
__field(u32, dev)
__field(u32, ring)
__field(u32, seqno)
__field(u32, global_seqno)
__field(u32, ctx)
__field(u32, port)
),
TP_fast_assign(
__entry->dev = req->i915->drm.primary->index;
__entry->ring = req->engine->id;
__entry->ctx = req->ctx->hw_id;
__entry->seqno = req->fence.seqno;
__entry->global_seqno = req->global_seqno;
__entry->port = port;
),
TP_printk("dev=%u, ring=%u, ctx=%u, seqno=%u, global=%u, port=%u",
__entry->dev, __entry->ring, __entry->ctx,
__entry->seqno, __entry->global_seqno,
__entry->port)
);
DEFINE_EVENT(i915_gem_request_hw, i915_gem_request_in,
TP_PROTO(struct drm_i915_gem_request *req, unsigned int port),
TP_ARGS(req, port)
);
DEFINE_EVENT(i915_gem_request, i915_gem_request_out,
TP_PROTO(struct drm_i915_gem_request *req),
TP_ARGS(req)
);
#else #else
#if !defined(TRACE_HEADER_MULTI_READ) #if !defined(TRACE_HEADER_MULTI_READ)
static inline void static inline void
...@@ -498,6 +537,16 @@ static inline void ...@@ -498,6 +537,16 @@ static inline void
trace_i915_gem_request_execute(struct drm_i915_gem_request *req) trace_i915_gem_request_execute(struct drm_i915_gem_request *req)
{ {
} }
static inline void
trace_i915_gem_request_in(struct drm_i915_gem_request *req, unsigned int port)
{
}
static inline void
trace_i915_gem_request_out(struct drm_i915_gem_request *req)
{
}
#endif #endif
#endif #endif
......
...@@ -479,6 +479,7 @@ static void execlists_dequeue(struct intel_engine_cs *engine) ...@@ -479,6 +479,7 @@ static void execlists_dequeue(struct intel_engine_cs *engine)
cursor->priotree.priority = INT_MAX; cursor->priotree.priority = INT_MAX;
__i915_gem_request_submit(cursor); __i915_gem_request_submit(cursor);
trace_i915_gem_request_in(cursor, port - engine->execlist_port);
last = cursor; last = cursor;
submit = true; submit = true;
} }
...@@ -593,6 +594,7 @@ static void intel_lrc_irq_handler(unsigned long data) ...@@ -593,6 +594,7 @@ static void intel_lrc_irq_handler(unsigned long data)
execlists_context_status_change(port[0].request, execlists_context_status_change(port[0].request,
INTEL_CONTEXT_SCHEDULE_OUT); INTEL_CONTEXT_SCHEDULE_OUT);
trace_i915_gem_request_out(port[0].request);
i915_gem_request_put(port[0].request); i915_gem_request_put(port[0].request);
port[0] = port[1]; port[0] = port[1];
memset(&port[1], 0, sizeof(port[1])); memset(&port[1], 0, sizeof(port[1]));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment