提交 151a99ec 编写于 作者: L Lionel Landwerlin

drm/i915/trace: add hw_id to gem requests trace points

When monitoring the GPU with i915 perf, reports are tagged with a hw
id. Gem context creation tracepoints already have a hw_id field,
unfortunately you only get this correlation between a process id and a
hw context id once when the context is created. It doesn't help if you
started monitoring after the process was initialized or if the drm fd
was transfered from one process to another.

This change adds the hw_id field to gem requests, so that correlation
can also be done on submission.

v2: Place hw_id at the end of the tracepoint to not disrupt too much
    existing tools (Chris)

v3: Reorder hw_id field again (Chris)

v4: Add missing hw_id to i915_gem_request_wait_begin tracepoint (Chris)
Signed-off-by: NLionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20171218151959.14073-3-lionel.g.landwerlin@intel.com
上级 3c2d0671
...@@ -616,6 +616,7 @@ TRACE_EVENT(i915_gem_request_queue, ...@@ -616,6 +616,7 @@ TRACE_EVENT(i915_gem_request_queue,
TP_STRUCT__entry( TP_STRUCT__entry(
__field(u32, dev) __field(u32, dev)
__field(u32, hw_id)
__field(u32, ring) __field(u32, ring)
__field(u32, ctx) __field(u32, ctx)
__field(u32, seqno) __field(u32, seqno)
...@@ -624,15 +625,16 @@ TRACE_EVENT(i915_gem_request_queue, ...@@ -624,15 +625,16 @@ TRACE_EVENT(i915_gem_request_queue,
TP_fast_assign( TP_fast_assign(
__entry->dev = req->i915->drm.primary->index; __entry->dev = req->i915->drm.primary->index;
__entry->hw_id = req->ctx->hw_id;
__entry->ring = req->engine->id; __entry->ring = req->engine->id;
__entry->ctx = req->fence.context; __entry->ctx = req->fence.context;
__entry->seqno = req->fence.seqno; __entry->seqno = req->fence.seqno;
__entry->flags = flags; __entry->flags = flags;
), ),
TP_printk("dev=%u, ring=%u, ctx=%u, seqno=%u, flags=0x%x", TP_printk("dev=%u, hw_id=%u, ring=%u, ctx=%u, seqno=%u, flags=0x%x",
__entry->dev, __entry->ring, __entry->ctx, __entry->seqno, __entry->dev, __entry->hw_id, __entry->ring, __entry->ctx,
__entry->flags) __entry->seqno, __entry->flags)
); );
DECLARE_EVENT_CLASS(i915_gem_request, DECLARE_EVENT_CLASS(i915_gem_request,
...@@ -641,6 +643,7 @@ DECLARE_EVENT_CLASS(i915_gem_request, ...@@ -641,6 +643,7 @@ DECLARE_EVENT_CLASS(i915_gem_request,
TP_STRUCT__entry( TP_STRUCT__entry(
__field(u32, dev) __field(u32, dev)
__field(u32, hw_id)
__field(u32, ring) __field(u32, ring)
__field(u32, ctx) __field(u32, ctx)
__field(u32, seqno) __field(u32, seqno)
...@@ -649,15 +652,16 @@ DECLARE_EVENT_CLASS(i915_gem_request, ...@@ -649,15 +652,16 @@ DECLARE_EVENT_CLASS(i915_gem_request,
TP_fast_assign( TP_fast_assign(
__entry->dev = req->i915->drm.primary->index; __entry->dev = req->i915->drm.primary->index;
__entry->hw_id = req->ctx->hw_id;
__entry->ring = req->engine->id; __entry->ring = req->engine->id;
__entry->ctx = req->fence.context; __entry->ctx = req->fence.context;
__entry->seqno = req->fence.seqno; __entry->seqno = req->fence.seqno;
__entry->global = req->global_seqno; __entry->global = req->global_seqno;
), ),
TP_printk("dev=%u, ring=%u, ctx=%u, seqno=%u, global=%u", TP_printk("dev=%u, hw_id=%u, ring=%u, ctx=%u, seqno=%u, global=%u",
__entry->dev, __entry->ring, __entry->ctx, __entry->seqno, __entry->dev, __entry->hw_id, __entry->ring, __entry->ctx,
__entry->global) __entry->seqno, __entry->global)
); );
DEFINE_EVENT(i915_gem_request, i915_gem_request_add, DEFINE_EVENT(i915_gem_request, i915_gem_request_add,
...@@ -683,6 +687,7 @@ DECLARE_EVENT_CLASS(i915_gem_request_hw, ...@@ -683,6 +687,7 @@ DECLARE_EVENT_CLASS(i915_gem_request_hw,
TP_STRUCT__entry( TP_STRUCT__entry(
__field(u32, dev) __field(u32, dev)
__field(u32, hw_id)
__field(u32, ring) __field(u32, ring)
__field(u32, ctx) __field(u32, ctx)
__field(u32, seqno) __field(u32, seqno)
...@@ -692,6 +697,7 @@ DECLARE_EVENT_CLASS(i915_gem_request_hw, ...@@ -692,6 +697,7 @@ DECLARE_EVENT_CLASS(i915_gem_request_hw,
TP_fast_assign( TP_fast_assign(
__entry->dev = req->i915->drm.primary->index; __entry->dev = req->i915->drm.primary->index;
__entry->hw_id = req->ctx->hw_id;
__entry->ring = req->engine->id; __entry->ring = req->engine->id;
__entry->ctx = req->fence.context; __entry->ctx = req->fence.context;
__entry->seqno = req->fence.seqno; __entry->seqno = req->fence.seqno;
...@@ -699,10 +705,10 @@ DECLARE_EVENT_CLASS(i915_gem_request_hw, ...@@ -699,10 +705,10 @@ DECLARE_EVENT_CLASS(i915_gem_request_hw,
__entry->port = port; __entry->port = port;
), ),
TP_printk("dev=%u, ring=%u, ctx=%u, seqno=%u, global=%u, port=%u", TP_printk("dev=%u, hw_id=%u, ring=%u, ctx=%u, seqno=%u, global=%u, port=%u",
__entry->dev, __entry->ring, __entry->ctx, __entry->dev, __entry->hw_id, __entry->ring,
__entry->seqno, __entry->global_seqno, __entry->ctx, __entry->seqno,
__entry->port) __entry->global_seqno, __entry->port)
); );
DEFINE_EVENT(i915_gem_request_hw, i915_gem_request_in, DEFINE_EVENT(i915_gem_request_hw, i915_gem_request_in,
...@@ -772,6 +778,7 @@ TRACE_EVENT(i915_gem_request_wait_begin, ...@@ -772,6 +778,7 @@ TRACE_EVENT(i915_gem_request_wait_begin,
TP_STRUCT__entry( TP_STRUCT__entry(
__field(u32, dev) __field(u32, dev)
__field(u32, hw_id)
__field(u32, ring) __field(u32, ring)
__field(u32, ctx) __field(u32, ctx)
__field(u32, seqno) __field(u32, seqno)
...@@ -787,6 +794,7 @@ TRACE_EVENT(i915_gem_request_wait_begin, ...@@ -787,6 +794,7 @@ TRACE_EVENT(i915_gem_request_wait_begin,
*/ */
TP_fast_assign( TP_fast_assign(
__entry->dev = req->i915->drm.primary->index; __entry->dev = req->i915->drm.primary->index;
__entry->hw_id = req->ctx->hw_id;
__entry->ring = req->engine->id; __entry->ring = req->engine->id;
__entry->ctx = req->fence.context; __entry->ctx = req->fence.context;
__entry->seqno = req->fence.seqno; __entry->seqno = req->fence.seqno;
...@@ -794,10 +802,10 @@ TRACE_EVENT(i915_gem_request_wait_begin, ...@@ -794,10 +802,10 @@ TRACE_EVENT(i915_gem_request_wait_begin,
__entry->flags = flags; __entry->flags = flags;
), ),
TP_printk("dev=%u, ring=%u, ctx=%u, seqno=%u, global=%u, blocking=%u, flags=0x%x", TP_printk("dev=%u, hw_id=%u, ring=%u, ctx=%u, seqno=%u, global=%u, blocking=%u, flags=0x%x",
__entry->dev, __entry->ring, __entry->ctx, __entry->seqno, __entry->dev, __entry->hw_id, __entry->ring, __entry->ctx,
__entry->global, !!(__entry->flags & I915_WAIT_LOCKED), __entry->seqno, __entry->global,
__entry->flags) !!(__entry->flags & I915_WAIT_LOCKED), __entry->flags)
); );
DEFINE_EVENT(i915_gem_request, i915_gem_request_wait_end, DEFINE_EVENT(i915_gem_request, i915_gem_request_wait_end,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册