public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915/selftests: Synchronize checking active status with retirement
@ 2019-10-22 11:21 Chris Wilson
  2019-10-22 19:23 ` ✓ Fi.CI.BAT: success for " Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Chris Wilson @ 2019-10-22 11:21 UTC (permalink / raw)
  To: intel-gfx

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@chris-wilson.co.uk>
---
Maybe? It really shouldn't make a difference, the case where it would
should not apply, surely...
---
 drivers/gpu/drm/i915/gt/selftest_engine_heartbeat.c | 13 +++++++++++++
 1 file changed, 13 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..5af27c37b65b 100644
--- a/drivers/gpu/drm/i915/gt/selftest_engine_heartbeat.c
+++ b/drivers/gpu/drm/i915/gt/selftest_engine_heartbeat.c
@@ -49,12 +49,20 @@ 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))
 {
 	struct pulse *p;
 	int err;
 
+	GEM_BUG_ON(!intel_engine_pm_is_awake(engine));
+
 	p = pulse_create();
 	if (!p)
 		return -ENOMEM;
@@ -73,16 +81,21 @@ static int __live_idle_pulse(struct intel_engine_cs *engine,
 	i915_active_release(&p->active);
 
 	GEM_BUG_ON(i915_active_is_idle(&p->active));
+	GEM_BUG_ON(llist_empty(&engine->barrier_tasks));
 
 	err = fn(engine);
 	if (err)
 		goto out;
 
+	GEM_BUG_ON(!llist_empty(&engine->barrier_tasks));
+
 	if (intel_gt_retire_requests_timeout(engine->gt, HZ / 5)) {
 		err = -ETIME;
 		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

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-10-23  9:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-22 11:21 [PATCH] drm/i915/selftests: Synchronize checking active status with retirement Chris Wilson
2019-10-22 19:23 ` ✓ Fi.CI.BAT: success for " Patchwork
2019-10-22 20:04 ` [PATCH] " Andi Shyti
2019-10-23  9:53 ` ✗ Fi.CI.IGT: failure for " Patchwork
2019-10-23  9:53   ` [Intel-gfx] " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox