[igt-dev] [RFC] tests/i915/gem_exec_fence: Pre-fault objects with dependencies

Antonio Argenziano antonio.argenziano at intel.com
Thu Mar 14 23:22:32 UTC 2019


In the fault manager code we wait on an active object to complete before
servicing the fault. This meant that the object 'out' used in the test
could not be read until it became inactive which could not happen since
it is kept busy from the store queued behind the spinner (at least). The
bug became evident only after using the mmap_offset patches since we
were not faulting before.

We haven't looked at all the tests yet so the issue might be present in
other tests as well. The solution proposed here is a pre-fault as soon
as the object is mapped. There is a question of does the kernel need to
allow for reads of a busy object or do we have a better way of fixing
this in IGT.

Cc: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Matthew Auld <matthew.auld at intel.com>
Cc: Daniele Spurio Ceraolo <daniele.ceraolospurio at intel.com>
Signed-off-by: Antonio Argenziano <antonio.argenziano at intel.com>
---
 tests/i915/gem_exec_fence.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/i915/gem_exec_fence.c b/tests/i915/gem_exec_fence.c
index ba46595d..2fe083fc 100644
--- a/tests/i915/gem_exec_fence.c
+++ b/tests/i915/gem_exec_fence.c
@@ -344,6 +344,8 @@ static void test_fence_await(int fd, unsigned ring, unsigned flags)
 	gem_set_domain(fd, obj.handle,
 			I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
 
+	*out = 0; /* Need to pre-fault this object otherwise, when reading it later on fault handler will block waiting on spinner therefore failing the test  */
+
 	batch = gem_mmap__wc(fd, obj.handle, 0, 4096, PROT_WRITE);
 	gem_set_domain(fd, obj.handle,
 			I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
@@ -400,7 +402,7 @@ static void test_fence_await(int fd, unsigned ring, unsigned flags)
 
 	/* Check for invalidly completing the task early */
 	for (int n = 0; n < i; n++)
-		igt_assert_eq_u32(out[n], 0);
+		igt_assert_eq_u32(out[n], 0); /* Requires out to be pre-faulted at this point or it will never get to unlocking the spinner  */
 
 	if ((flags & HANG) == 0) {
 		*batch = MI_BATCH_BUFFER_END;
-- 
2.20.1



More information about the igt-dev mailing list