[Intel-gfx] [PATCH i-g-t] i915/gem_exec_whipser: Pass early exit onto check_bo

Chris Wilson chris at chris-wilson.co.uk
Mon Jan 14 16:34:32 UTC 2019


If we break out of the test loop early, we may not have filled all
dwords, so be careful to only check as far as we completed.

Fixes: d9cd03c887a5 ("i915/gem_exec_whisper: Limit to a maximum of 150s")
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 tests/i915/gem_exec_whisper.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tests/i915/gem_exec_whisper.c b/tests/i915/gem_exec_whisper.c
index 277b678c4..0b15fe431 100644
--- a/tests/i915/gem_exec_whisper.c
+++ b/tests/i915/gem_exec_whisper.c
@@ -52,15 +52,14 @@ static void write_seqno(int dir, unsigned offset)
 	igt_debug("next seqno set to: 0x%x\n", seqno);
 }
 
-static void check_bo(int fd, uint32_t handle)
+static void check_bo(int fd, uint32_t handle, int pass)
 {
 	uint32_t *map;
-	int i;
 
 	igt_debug("Verifying result\n");
 	map = gem_mmap__cpu(fd, handle, 0, 4096, PROT_READ);
 	gem_set_domain(fd, handle, I915_GEM_DOMAIN_CPU, 0);
-	for (i = 0; i < 1024; i++)
+	for (int i = 0; i < pass; i++)
 		igt_assert_eq(map[i], i);
 	munmap(map, 4096);
 }
@@ -228,6 +227,8 @@ static void whisper(int fd, unsigned engine, unsigned flags)
 
 	intel_detect_and_clear_missed_interrupts(fd);
 	igt_fork(child, flags & FORKED ? sysconf(_SC_NPROCESSORS_ONLN) : 1)  {
+		unsigned int pass;
+
 		memset(&scratch, 0, sizeof(scratch));
 		scratch.handle = gem_create(fd, 4096);
 		scratch.flags = EXEC_OBJECT_WRITE;
@@ -323,8 +324,7 @@ static void whisper(int fd, unsigned engine, unsigned flags)
 		}
 
 		igt_while_interruptible(flags & INTERRUPTIBLE) {
-			unsigned int pass = 0;
-
+			pass = 0;
 			igt_until_timeout(150) {
 				uint64_t offset;
 
@@ -473,7 +473,7 @@ static void whisper(int fd, unsigned engine, unsigned flags)
 		igt_info("Number of migrations for execbuf: %d\n", eb_migrations);
 		igt_info("Number of migrations for reloc: %d, interrupted %d, patched %d\n", reloc_migrations, reloc_interruptions, relocations);
 
-		check_bo(fd, scratch.handle);
+		check_bo(fd, scratch.handle, pass);
 		gem_close(fd, scratch.handle);
 		gem_close(fd, store.handle);
 
-- 
2.20.1



More information about the Intel-gfx mailing list