@@ -1252,18 +1252,17 @@ __execlists_schedule_in(struct i915_request *rq)
if (IS_ENABLED(CONFIG_DRM_I915_DEBUG_GEM))
execlists_check_context(ce, engine);
- ce->lrc_desc &= ~GENMASK_ULL(47, 37);
if (ce->tag) {
- /* Use a fixed tag for OA and friends */
- ce->lrc_desc |= (u64)ce->tag << 32;
+ rq->tag = ce->tag;
} else {
- /* We don't need a strict matching tag, just different values */
- ce->lrc_desc |=
- (u64)(++engine->context_tag % NUM_CONTEXT_TAG) <<
- GEN11_SW_CTX_ID_SHIFT;
+ rq->tag = (++engine->context_tag % NUM_CONTEXT_TAG) <<
+ (GEN11_SW_CTX_ID_SHIFT - 32);
BUILD_BUG_ON(NUM_CONTEXT_TAG > GEN12_MAX_CONTEXT_HW_ID);
}
+ ce->lrc_desc &= ~GENMASK_ULL(47, 37);
+ ce->lrc_desc |= (u64)rq->tag << 32;
+
__intel_gt_pm_get(engine->gt);
execlists_context_status_change(rq, INTEL_CONTEXT_SCHEDULE_IN);
intel_engine_context_in(engine);
@@ -1278,7 +1277,6 @@ execlists_schedule_in(struct i915_request *rq, int idx)
struct intel_engine_cs *old;
GEM_BUG_ON(!intel_engine_pm_is_awake(rq->engine));
- trace_i915_request_in(rq, idx);
old = READ_ONCE(ce->inflight);
do {
@@ -1288,6 +1286,8 @@ execlists_schedule_in(struct i915_request *rq, int idx)
}
} while (!try_cmpxchg(&ce->inflight, &old, ptr_inc(old)));
+ trace_i915_request_in(rq, idx);
+
GEM_BUG_ON(intel_context_inflight(ce) != rq->engine);
return i915_request_get(rq);
}
@@ -289,6 +289,9 @@ struct i915_request {
struct list_head link;
unsigned long delay;
} mock;)
+
+ /** Last tag used in the execlist descriptor */
+ u32 tag;
};
#define I915_FENCE_GFP (GFP_KERNEL | __GFP_RETRY_MAYFAIL | __GFP_NOWARN)
@@ -801,6 +801,7 @@ TRACE_EVENT(i915_request_in,
__field(u32, seqno)
__field(u32, port)
__field(s32, prio)
+ __field(u32, tag)
),
TP_fast_assign(
@@ -811,6 +812,7 @@ TRACE_EVENT(i915_request_in,
__entry->seqno = rq->fence.seqno;
__entry->prio = rq->sched.attr.priority;
__entry->port = port;
+ __entry->tag = rq->tag;
),
TP_printk("dev=%u, engine=%u:%u, ctx=%llu, seqno=%u, prio=%d, port=%u",
In Gpuvis [1] we added matching of the OA report tags against i915 tracepoints fields to figure what workload was submitted by what process. But the tags got removed from the tracepoints in 2935ed5339c4 ("drm/i915: Remove logical HW ID"). I would like to bring the tags back so that we can built the HW tag to process relationship when post processing perf & i915/perf data. [1] : https://github.com/mikesart/gpuvis/wiki/TechDocs-Intel#gpu-generated-countersevents Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> --- drivers/gpu/drm/i915/gt/intel_lrc.c | 16 ++++++++-------- drivers/gpu/drm/i915/i915_request.h | 3 +++ drivers/gpu/drm/i915/i915_trace.h | 2 ++ 3 files changed, 13 insertions(+), 8 deletions(-)