All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-gfx] [PATCH 01/13] drm/i915: Flush idle barriers when waiting
@ 2020-01-14  9:36 Chris Wilson
  2020-01-14  9:36 ` [Intel-gfx] [PATCH 02/13] drm/i915: Allow userspace to specify ringsize on construction Chris Wilson
                   ` (16 more replies)
  0 siblings, 17 replies; 20+ messages in thread
From: Chris Wilson @ 2020-01-14  9:36 UTC (permalink / raw)
  To: intel-gfx

If we do find ourselves with an idle barrier inside our active while
waiting, attempt to flush it by emitting a pulse using the kernel
context.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_active.c           | 21 ++++++++-
 drivers/gpu/drm/i915/selftests/i915_active.c | 46 ++++++++++++++++++++
 2 files changed, 65 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_active.c b/drivers/gpu/drm/i915/i915_active.c
index f3da5c06f331..fca5de1f2e7e 100644
--- a/drivers/gpu/drm/i915/i915_active.c
+++ b/drivers/gpu/drm/i915/i915_active.c
@@ -7,6 +7,7 @@
 #include <linux/debugobjects.h>
 
 #include "gt/intel_context.h"
+#include "gt/intel_engine_heartbeat.h"
 #include "gt/intel_engine_pm.h"
 #include "gt/intel_ring.h"
 
@@ -448,6 +449,21 @@ static void enable_signaling(struct i915_active_fence *active)
 	dma_fence_put(fence);
 }
 
+static int flush_barrier(struct active_node *it)
+{
+	struct intel_engine_cs *engine;
+
+	if (!is_barrier(&it->base))
+		return 0;
+
+	engine = __barrier_to_engine(it);
+	smp_rmb(); /* serialise with add_active_barriers */
+	if (!is_barrier(&it->base))
+		return 0;
+
+	return intel_engine_flush_barriers(engine);
+}
+
 int i915_active_wait(struct i915_active *ref)
 {
 	struct active_node *it, *n;
@@ -461,8 +477,9 @@ int i915_active_wait(struct i915_active *ref)
 	/* Flush lazy signals */
 	enable_signaling(&ref->excl);
 	rbtree_postorder_for_each_entry_safe(it, n, &ref->tree, node) {
-		if (is_barrier(&it->base)) /* unconnected idle barrier */
-			continue;
+		err = flush_barrier(it); /* unconnected idle barrier? */
+		if (err)
+			break;
 
 		enable_signaling(&it->base);
 	}
diff --git a/drivers/gpu/drm/i915/selftests/i915_active.c b/drivers/gpu/drm/i915/selftests/i915_active.c
index ef572a0c2566..067e30b8927f 100644
--- a/drivers/gpu/drm/i915/selftests/i915_active.c
+++ b/drivers/gpu/drm/i915/selftests/i915_active.c
@@ -201,11 +201,57 @@ static int live_active_retire(void *arg)
 	return err;
 }
 
+static int live_active_barrier(void *arg)
+{
+	struct drm_i915_private *i915 = arg;
+	struct intel_engine_cs *engine;
+	struct live_active *active;
+	int err = 0;
+
+	/* Check that we get a callback when requests retire upon waiting */
+
+	active = __live_alloc(i915);
+	if (!active)
+		return -ENOMEM;
+
+	err = i915_active_acquire(&active->base);
+	if (err)
+		goto out;
+
+	for_each_uabi_engine(engine, i915) {
+		err = i915_active_acquire_preallocate_barrier(&active->base,
+							      engine);
+		if (err)
+			break;
+
+		i915_active_acquire_barrier(&active->base);
+	}
+
+	i915_active_release(&active->base);
+
+	if (err == 0)
+		err = i915_active_wait(&active->base);
+
+	if (err == 0 && !READ_ONCE(active->retired)) {
+		pr_err("i915_active not retired after flushing barriers!\n");
+		err = -EINVAL;
+	}
+
+out:
+	__live_put(active);
+
+	if (igt_flush_test(i915))
+		err = -EIO;
+
+	return err;
+}
+
 int i915_active_live_selftests(struct drm_i915_private *i915)
 {
 	static const struct i915_subtest tests[] = {
 		SUBTEST(live_active_wait),
 		SUBTEST(live_active_retire),
+		SUBTEST(live_active_barrier),
 	};
 
 	if (intel_gt_is_wedged(&i915->gt))
-- 
2.25.0.rc2

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

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

end of thread, other threads:[~2020-01-16 11:46 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-14  9:36 [Intel-gfx] [PATCH 01/13] drm/i915: Flush idle barriers when waiting Chris Wilson
2020-01-14  9:36 ` [Intel-gfx] [PATCH 02/13] drm/i915: Allow userspace to specify ringsize on construction Chris Wilson
2020-01-14  9:36 ` [Intel-gfx] [PATCH 03/13] drm/i915/gem: Honour O_NONBLOCK before throttling execbuf submissions Chris Wilson
2020-01-14  9:36 ` [Intel-gfx] [PATCH 04/13] drm/i915: Only retire requests when eviction is allowed to blocked Chris Wilson
2020-01-14  9:36 ` [Intel-gfx] [PATCH 05/13] drm/i915: Disable preemption support on Icelake Chris Wilson
2020-01-14  9:36 ` [Intel-gfx] [PATCH 06/13] drm/i915/gt: Expose engine properties via sysfs Chris Wilson
2020-01-14  9:36 ` [Intel-gfx] [PATCH 07/13] drm/i915/gt: Expose engine->mmio_base " Chris Wilson
2020-01-14  9:36 ` [Intel-gfx] [PATCH 08/13] drm/i915/gt: Expose timeslice duration to sysfs Chris Wilson
2020-01-14  9:36 ` [Intel-gfx] [PATCH 09/13] drm/i915/gt: Expose busywait " Chris Wilson
2020-01-14  9:36 ` [Intel-gfx] [PATCH 10/13] drm/i915/gt: Expose reset stop timeout via sysfs Chris Wilson
2020-01-14  9:36 ` [Intel-gfx] [PATCH 11/13] drm/i915/gt: Expose preempt reset " Chris Wilson
2020-01-14  9:36 ` [Intel-gfx] [PATCH 12/13] drm/i915/gt: Expose heartbeat interval " Chris Wilson
2020-01-14  9:36 ` [Intel-gfx] [PATCH 13/13] drm/i915/gt: Limit C-states while waiting for requests Chris Wilson
2020-01-14 15:12   ` Mika Kuoppala
2020-01-14 15:18     ` Chris Wilson
2020-01-14 10:08 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [01/13] drm/i915: Flush idle barriers when waiting Patchwork
2020-01-14 10:14 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2020-01-14 10:38 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2020-01-14 10:38 ` [Intel-gfx] ✗ Fi.CI.BUILD: warning " Patchwork
2020-01-16 11:46 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.