diff mbox series

[i-g-t] i915/gem_eio: Restrict number of batches of submitted

Message ID 20190812151256.10657-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show
Series [i-g-t] i915/gem_eio: Restrict number of batches of submitted | expand

Commit Message

Chris Wilson Aug. 12, 2019, 3:12 p.m. UTC
Make sure we don't block while setting up the stress case before the
reset by only submitting less batches than would fill the ring.

References: https://bugs.freedesktop.org/show_bug.cgi?id=111379
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/i915/gem_eio.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/tests/i915/gem_eio.c b/tests/i915/gem_eio.c
index dcbcefa97..9b086a039 100644
--- a/tests/i915/gem_eio.c
+++ b/tests/i915/gem_eio.c
@@ -734,6 +734,11 @@  static void reset_stress(int fd, uint32_t ctx0,
 		.flags = engine,
 	};
 	igt_stats_t stats;
+	int max;
+
+	max = gem_measure_ring_inflight(fd, engine, 0);
+	max = max / 2 - 1; /* assume !execlists and a shared ring */
+	igt_require(max > 0);
 
 	gem_write(fd, obj.handle, 0, &bbe, sizeof(bbe));
 
@@ -755,11 +760,11 @@  static void reset_stress(int fd, uint32_t ctx0,
 		hang = spin_sync(fd, ctx0, engine);
 
 		execbuf.rsvd1 = ctx;
-		for (i = 0; i < 10; i++)
+		for (i = 0; i < max; i++)
 			gem_execbuf(fd, &execbuf);
 
 		execbuf.rsvd1 = ctx0;
-		for (i = 0; i < 10; i++)
+		for (i = 0; i < max; i++)
 			gem_execbuf(fd, &execbuf);
 
 		/* Wedge after a small delay. */
@@ -777,11 +782,11 @@  static void reset_stress(int fd, uint32_t ctx0,
 		 * both contexts.
 		 */
 		execbuf.rsvd1 = ctx;
-		for (i = 0; i < 5; i++)
+		for (i = 0; i < max; i++)
 			gem_execbuf(fd, &execbuf);
 
 		execbuf.rsvd1 = ctx0;
-		for (i = 0; i < 5; i++)
+		for (i = 0; i < max; i++)
 			gem_execbuf(fd, &execbuf);
 
 		gem_sync(fd, obj.handle);