[PATCH] drm/i915/selftests: Synchronize checking active status with retirement
Chris Wilson
chris at chris-wilson.co.uk
Mon Oct 21 22:24:39 UTC 2019
If retirement is running on another thread, we may inspect the status of
the i915_active before its retirement callback is complete. As we expect
it to be running synchronously, we can wait for any callback to complete
by acquiring the i915_active.mutex.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
drivers/gpu/drm/i915/gt/selftest_engine_heartbeat.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/gpu/drm/i915/gt/selftest_engine_heartbeat.c b/drivers/gpu/drm/i915/gt/selftest_engine_heartbeat.c
index 1f5ab59ad6e7..57a3a53b7087 100644
--- a/drivers/gpu/drm/i915/gt/selftest_engine_heartbeat.c
+++ b/drivers/gpu/drm/i915/gt/selftest_engine_heartbeat.c
@@ -49,6 +49,12 @@ static struct pulse *pulse_create(void)
return p;
}
+static void pulse_unlock_wait(struct pulse *p)
+{
+ mutex_lock(&p->active.mutex);
+ mutex_unlock(&p->active.mutex);
+}
+
static int __live_idle_pulse(struct intel_engine_cs *engine,
int (*fn)(struct intel_engine_cs *cs))
{
@@ -83,6 +89,8 @@ static int __live_idle_pulse(struct intel_engine_cs *engine,
goto out;
}
+ pulse_unlock_wait(p); /* synchronize with the retirement callback */
+
if (!i915_active_is_idle(&p->active)) {
pr_err("%s: heartbeat pulse did not flush idle tasks\n",
engine->name);
--
2.24.0.rc0
More information about the Intel-gfx-trybot
mailing list