[Intel-gfx] [PATCH 3/3] drm/i915/perf: Wait for lrc_reconfigure on disable
Chris Wilson
chris at chris-wilson.co.uk
Wed Feb 26 21:30:42 UTC 2020
Wait for the last request (and so waits for all context updates) when
disabling OA. This prevents a rather bizarre error seen on Skylake
where the context is subsequently corrupted. Let's play safe and assume
it may impact all.
Reported-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
---
drivers/gpu/drm/i915/i915_perf.c | 23 +++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
index 2334c45f1d08..20c68b5dea63 100644
--- a/drivers/gpu/drm/i915/i915_perf.c
+++ b/drivers/gpu/drm/i915/i915_perf.c
@@ -2191,7 +2191,8 @@ static int gen8_modify_context(struct intel_context *ce,
}
static int gen8_modify_self(struct intel_context *ce,
- const struct flex *flex, unsigned int count)
+ const struct flex *flex, unsigned int count,
+ bool sync)
{
struct i915_request *rq;
int err;
@@ -2204,7 +2205,12 @@ static int gen8_modify_self(struct intel_context *ce,
err = gen8_load_flex(rq, ce, flex, count);
+ i915_request_get(rq);
i915_request_add(rq);
+ if (sync && i915_request_wait(rq, 0, HZ) < 0)
+ err = -ETIME;
+ i915_request_put(rq);
+
return err;
}
@@ -2281,7 +2287,7 @@ static int gen12_configure_oar_context(struct i915_perf_stream *stream, bool ena
return err;
/* Apply regs_lri using LRI with pinned context */
- return gen8_modify_self(ce, regs_lri, ARRAY_SIZE(regs_lri));
+ return gen8_modify_self(ce, regs_lri, ARRAY_SIZE(regs_lri), false);
}
/*
@@ -2311,7 +2317,8 @@ static int gen12_configure_oar_context(struct i915_perf_stream *stream, bool ena
*/
static int oa_configure_all_contexts(struct i915_perf_stream *stream,
struct flex *regs,
- size_t num_regs)
+ size_t num_regs,
+ bool enable)
{
struct drm_i915_private *i915 = stream->perf->i915;
struct intel_engine_cs *engine;
@@ -2368,7 +2375,7 @@ static int oa_configure_all_contexts(struct i915_perf_stream *stream,
regs[0].value = intel_sseu_make_rpcs(i915, &ce->sseu);
- err = gen8_modify_self(ce, regs, num_regs);
+ err = gen8_modify_self(ce, regs, num_regs, !enable);
if (err)
return err;
}
@@ -2386,7 +2393,9 @@ static int gen12_configure_all_contexts(struct i915_perf_stream *stream,
},
};
- return oa_configure_all_contexts(stream, regs, ARRAY_SIZE(regs));
+ return oa_configure_all_contexts(stream,
+ regs, ARRAY_SIZE(regs),
+ oa_config);
}
static int lrc_configure_all_contexts(struct i915_perf_stream *stream,
@@ -2423,7 +2432,9 @@ static int lrc_configure_all_contexts(struct i915_perf_stream *stream,
for (i = 2; i < ARRAY_SIZE(regs); i++)
regs[i].value = oa_config_flex_reg(oa_config, regs[i].reg);
- return oa_configure_all_contexts(stream, regs, ARRAY_SIZE(regs));
+ return oa_configure_all_contexts(stream,
+ regs, ARRAY_SIZE(regs),
+ oa_config);
}
static int gen8_enable_metric_set(struct i915_perf_stream *stream)
--
2.25.1
More information about the Intel-gfx
mailing list