diff mbox

[i-g-t,v3] tests/gem_ringfill: Add {render, blitter}-forked-1 subtests.

Message ID 1435319554.31369.0.camel@jlahtine-mobl1 (mailing list archive)
State New, archived
Headers show

Commit Message

Joonas Lahtinen June 26, 2015, 11:52 a.m. UTC
Add forking subtests to gem_ringfill. Tests cause consistent GPU
hangs on SKL.

v2: Removed noop parts.
v3:
- Allow executing the tests in order too (Chris Wilson).
- Rename the tests to -forked-1

Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89959
---
 tests/gem_ringfill.c | 91 ++++++++++++++++++++++++++++++++--------------------
 1 file changed, 57 insertions(+), 34 deletions(-)

Comments

Chris Wilson June 29, 2015, 10:42 a.m. UTC | #1
On Fri, Jun 26, 2015 at 02:52:34PM +0300, Joonas Lahtinen wrote:
> Add forking subtests to gem_ringfill. Tests cause consistent GPU
> hangs on SKL.
> 
> v2: Removed noop parts.
> v3:
> - Allow executing the tests in order too (Chris Wilson).
> - Rename the tests to -forked-1
> 
> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89959

I extended the test to cover the forked-N case and found that we shared
the first batch handle (due to creating the intel_batch_buffer in the
parent). Fixed that up and pushed, hopefully it still causes SKL to die
horribly.
-Chris
Mika Kuoppala July 1, 2015, 1:19 p.m. UTC | #2
Chris Wilson <chris@chris-wilson.co.uk> writes:

> On Fri, Jun 26, 2015 at 02:52:34PM +0300, Joonas Lahtinen wrote:
>> Add forking subtests to gem_ringfill. Tests cause consistent GPU
>> hangs on SKL.
>> 
>> v2: Removed noop parts.
>> v3:
>> - Allow executing the tests in order too (Chris Wilson).
>> - Rename the tests to -forked-1
>> 
>> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
>> Cc: Chris Wilson <chris@chris-wilson.co.uk>
>> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89959
>
> I extended the test to cover the forked-N case and found that we shared
> the first batch handle (due to creating the intel_batch_buffer in the
> parent). Fixed that up and pushed, hopefully it still causes SKL to die
> horribly.

It does, very well. And has already helped to isolate the blitter
ctx switches out from the pool of suspects. Thanks for the test
and pushing it.
-Mika

> -Chris
>
> -- 
> Chris Wilson, Intel Open Source Technology Centre
diff mbox

Patch

diff --git a/tests/gem_ringfill.c b/tests/gem_ringfill.c
index 85b01ea..06da1c2 100644
--- a/tests/gem_ringfill.c
+++ b/tests/gem_ringfill.c
@@ -55,6 +55,7 @@  struct bo {
 };
 
 static const int width = 512, height = 512;
+int fd;
 
 static void create_bo(drm_intel_bufmgr *bufmgr,
 		      struct bo *b,
@@ -193,9 +194,52 @@  static void blt_copy(struct intel_batchbuffer *batch,
 	intel_batchbuffer_flush(batch);
 }
 
-drm_intel_bufmgr *bufmgr;
-struct intel_batchbuffer *batch;
-int fd;
+static void run_test(int ring, bool interruptible, int nchild) {
+	drm_intel_bufmgr *bufmgr;
+	struct intel_batchbuffer *batch;
+	igt_render_copyfunc_t copy;
+	const char* ring_name;
+
+	bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
+	igt_require(bufmgr);
+	drm_intel_bufmgr_gem_enable_reuse(bufmgr);
+
+	batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
+	igt_require(batch);
+
+	if (ring == I915_EXEC_RENDER) {
+		copy = igt_get_render_copyfunc(batch->devid);
+		ring_name = "render";
+	} else if (ring == I915_EXEC_BLT) {
+		copy = blt_copy;
+		ring_name = "blt";
+	} else {
+		igt_fail_on_f(true, "Unsupported ring.");
+	}
+
+	/* Not all platforms have dedicated render ring. */
+	igt_require(copy);
+
+	if (interruptible) {
+		igt_fork_signal_helper();
+	}
+
+	if (nchild) {
+		igt_fork(child, nchild) {
+			check_ring(bufmgr, batch, ring_name, copy);
+		}
+		igt_waitchildren();
+	} else {
+		check_ring(bufmgr, batch, ring_name, copy);
+	}
+
+	if (interruptible) {
+		igt_stop_signal_helper();
+	}
+
+	intel_batchbuffer_free(batch);
+	drm_intel_bufmgr_destroy(bufmgr);
+}
 
 igt_main
 {
@@ -203,48 +247,27 @@  igt_main
 
 	igt_fixture {
 		fd = drm_open_any();
-
-		bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
-		drm_intel_bufmgr_gem_enable_reuse(bufmgr);
-		batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
 	}
 
 	igt_subtest("blitter")
-		check_ring(bufmgr, batch, "blt", blt_copy);
+		run_test(I915_EXEC_BLT, false, 0);
 
-	/* Strictly only required on architectures with a separate BLT ring,
-	 * but lets stress everybody.
-	 */
-	igt_subtest("render") {
-		igt_render_copyfunc_t copy;
-
-		copy = igt_get_render_copyfunc(batch->devid);
-		igt_require(copy);
+	igt_subtest("render")
+		run_test(I915_EXEC_RENDER, false, 0);
 
-		check_ring(bufmgr, batch, "render", copy);
-	}
-
-	igt_fork_signal_helper();
 	igt_subtest("blitter-interruptible")
-		check_ring(bufmgr, batch, "blt", blt_copy);
+		run_test(I915_EXEC_BLT, true, 0);
 
-	/* Strictly only required on architectures with a separate BLT ring,
-	 * but lets stress everybody.
-	 */
-	igt_subtest("render-interruptible") {
-		igt_render_copyfunc_t copy;
+	igt_subtest("render-interruptible")
+		run_test(I915_EXEC_RENDER, true, 0);
 
-		copy = igt_get_render_copyfunc(batch->devid);
-		igt_require(copy);
+	igt_subtest("blitter-forked-1")
+		run_test(I915_EXEC_BLT, false, 1);
 
-		check_ring(bufmgr, batch, "render", copy);
-	}
-	igt_stop_signal_helper();
+	igt_subtest("render-forked-1")
+		run_test(I915_EXEC_RENDER, false, 1);
 
 	igt_fixture {
-		intel_batchbuffer_free(batch);
-		drm_intel_bufmgr_destroy(bufmgr);
-
 		close(fd);
 	}
 }