[igt-dev] [PATCH i-g-t] i915/gem_eio: Break early for small rings

Chris Wilson chris at chris-wilson.co.uk
Mon Jul 29 12:27:27 UTC 2019


If the shared legacy ringbuffer is too small to fit 64 new contexts, it
will hang and report -EIO before we are expecting it. Accommodate this
eio as it part of the ABI we are testing.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 tests/i915/gem_eio.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tests/i915/gem_eio.c b/tests/i915/gem_eio.c
index 4d7362d8f..dcbcefa97 100644
--- a/tests/i915/gem_eio.c
+++ b/tests/i915/gem_eio.c
@@ -559,6 +559,7 @@ static void test_inflight_contexts(int fd, unsigned int wait)
 		const uint32_t bbe = MI_BATCH_BUFFER_END;
 		struct drm_i915_gem_exec_object2 obj[2];
 		struct drm_i915_gem_execbuffer2 execbuf;
+		unsigned int count;
 		igt_spin_t *hang;
 		uint32_t ctx[64];
 		int fence[64];
@@ -587,16 +588,19 @@ static void test_inflight_contexts(int fd, unsigned int wait)
 		execbuf.buffer_count = 2;
 		execbuf.flags = engine | I915_EXEC_FENCE_OUT;
 
+		count = 0;
 		for (unsigned int n = 0; n < ARRAY_SIZE(fence); n++) {
 			execbuf.rsvd1 = ctx[n];
-			gem_execbuf_wr(fd, &execbuf);
+			if (__gem_execbuf_wr(fd, &execbuf))
+				break; /* small shared ring */
 			fence[n] = execbuf.rsvd2 >> 32;
 			igt_assert(fence[n] != -1);
+			count++;
 		}
 
 		check_wait(fd, obj[1].handle, wait, NULL);
 
-		for (unsigned int n = 0; n < ARRAY_SIZE(fence); n++) {
+		for (unsigned int n = 0; n < count; n++) {
 			igt_assert_eq(sync_fence_status(fence[n]), -EIO);
 			close(fence[n]);
 		}
-- 
2.22.0



More information about the igt-dev mailing list