drm/i915: avoid concurrent writes to aux_inv
Subsystems (2)
PATCH 1/1 drm/i915: avoid concurrent writes to aux_inv
From: Fei Yang <[email protected]>
GPU hangs have been observed when multiple engines write to the same aux_inv register at the same time. To avoid this each engine should only invalidate its own auxiliary table. The function gen12_emit_flush_xcs() currently invalidate the auxiliary table for all engines because the rq->engine is not necessarily the engine eventually carrying out the request, and potentially the engine could even be a virtual one (with engine->instance being -1). With this patch, auxiliary table invalidation is done only for the engine executing the request. And the mmio address for the aux_inv register is set after the engine instance becomes certain.
--- drivers/gpu/drm/i915/gt/gen2_engine_cs.c | 9 +++ drivers/gpu/drm/i915/gt/gen6_engine_cs.c | 9 +++ drivers/gpu/drm/i915/gt/gen8_engine_cs.c | 61 ++++++++----------- .../drm/i915/gt/intel_execlists_submission.c | 35 +++++++++++ drivers/gpu/drm/i915/i915_request.h | 2 + 5 files changed, 82 insertions(+), 34 deletions(-)
drivers/gpu/drm/i915/gt/gen2_engine_cs.c +9 -0
@@ -37,6 +37,9 @@ int gen2_emit_flush(struct i915_request *rq, u32 mode)intel_ring_advance (rq, cs); +/* hsdes: 1809175790. No fixup needed for gen2 */ + rq->aux_inv_fixup =NULL ; +return 0 ; }
@@ -123,6 +126,9 @@ int gen4_emit_flush_rcs(struct i915_request *rq, u32 mode)intel_ring_advance (rq, cs); +/* hsdes: 1809175790. No fixup needed for gen4 rcs */ + rq->aux_inv_fixup =NULL ; +return 0 ; }
@@ -138,6 +144,9 @@ int gen4_emit_flush_vcs(struct i915_request *rq, u32 mode) *cs++ =MI_NOOP ;intel_ring_advance (rq, cs); +/* hsdes: 1809175790. No fixup needed for gen4 vcs */ + rq->aux_inv_fixup =NULL ; +return 0 ; }
drivers/gpu/drm/i915/gt/gen6_engine_cs.c +9 -0
@@ -137,6 +137,9 @@ int gen6_emit_flush_rcs(struct i915_request *rq, u32 mode) *cs++ =0 ;intel_ring_advance (rq, cs); +/* hsdes: 1809175790. No fixup needed for gen6 */ + rq->aux_inv_fixup =NULL ; +return 0 ; }
@@ -208,6 +211,9 @@ static int mi_flush_dw(struct i915_request *rq, u32 flags)intel_ring_advance (rq, cs); +/* hsdes: 1809175790. No fixup needed for gen6 */ + rq->aux_inv_fixup =NULL ; +return 0 ; }
@@ -347,6 +353,9 @@ int gen7_emit_flush_rcs(struct i915_request *rq, u32 mode) *cs++ =0 ;intel_ring_advance (rq, cs); +/* hsdes: 1809175790. No fixup needed for gen7 rcs */ + rq->aux_inv_fixup =NULL ; +return 0 ; }
drivers/gpu/drm/i915/gt/gen8_engine_cs.c +27 -34
104 lines not on this page · raw message
drivers/gpu/drm/i915/gt/intel_execlists_submission.c +35 -0
@@ -1258,6 +1258,34 @@ static bool completed(const struct i915_request *rq)return __i915_request_is_complete (rq); } +static i915_reg_t aux_inv_reg (const struct intel_engine_cs *engine) +{ +static const i915_reg_t vd[] = { +GEN12_VD0_AUX_NV , +GEN12_VD1_AUX_NV , +GEN12_VD2_AUX_NV , +GEN12_VD3_AUX_NV , + }; + +static const i915_reg_t ve[] = { +GEN12_VE0_AUX_NV , +GEN12_VE1_AUX_NV , + }; + +if (engine->class ==VIDEO_DECODE_CLASS ) { +GEM_BUG_ON (engine->instance >=ARRAY_SIZE (vd)); +return vd[engine->instance]; + } + +if (engine->class ==VIDEO_ENHANCEMENT_CLASS ) { +GEM_BUG_ON (engine->instance >=ARRAY_SIZE (ve)); +return ve[engine->instance]; + } + +GEM_BUG_ON ("unknown aux_inv reg\n" ); +return INVALID_MMIO_REG ; +} +static void execlists_dequeue (struct intel_engine_cs *engine) {struct intel_engine_execlists *const execlists = &engine->execlists;
@@ -1538,6 +1566,13 @@ static void execlists_dequeue(struct intel_engine_cs *engine) }if (__i915_request_submit (rq)) { +/* hsdes: 1809175790 */ +if (rq->aux_inv_fixup) { + *rq->aux_inv_fixup = +i915_mmio_reg_offset + (aux_inv_reg (engine)); + rq->execution_mask = engine->mask; + }if (!merge) { *port++ =i915_request_get (last); last =NULL ;
drivers/gpu/drm/i915/i915_request.h +2 -0
@@ -312,6 +312,8 @@ struct i915_request {struct i915_capture_list *capture_list;#endif +u32 *aux_inv_fixup;/* hsdes: 1809175790 */ +/** Time at which this request was emitted, in jiffies. */ unsigned long emitted_jiffies;
Signature · 1 line
2.25.1