[Intel-gfx] [PATCH igt 09/10] igt/gem_userptr_blits: Errors from gup are permanent

Chris Wilson chris at chris-wilson.co.uk
Fri Jul 28 12:08:07 UTC 2017


After triggering an error (such as trying to use userptr on a GTT
mmaping), we store the EFAULT on the object permanently. So to test the
error, we must sacrifice the object and recreate the userptr handle.
We restrict the error to just one of the overlapping userptr handles to
check the object independence.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100596
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 tests/gem_userptr_blits.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tests/gem_userptr_blits.c b/tests/gem_userptr_blits.c
index 7767c0ca..849054ad 100644
--- a/tests/gem_userptr_blits.c
+++ b/tests/gem_userptr_blits.c
@@ -681,12 +681,17 @@ static int test_map_fixed_invalidate(int fd, uint32_t flags)
 		gem_set_tiling(fd, mmap_gtt.handle, I915_TILING_NONE, 0);
 		*map = 0xdead;
 
-		if (flags & MAP_FIXED_INVALIDATE_GET_PAGES)
+		if (flags & MAP_FIXED_INVALIDATE_GET_PAGES) {
 			igt_assert_eq(__gem_set_domain(fd, handle[0],
 						       I915_GEM_DOMAIN_GTT,
 						       I915_GEM_DOMAIN_GTT),
 				      -EFAULT);
 
+			/* Errors are permanent, so we have to recreate */
+			gem_close(fd, handle[0]);
+			handle[0] = create_userptr(fd, 0, ptr + PAGE_SIZE/sizeof(*ptr));
+		}
+
 		gem_set_tiling(fd, mmap_gtt.handle, I915_TILING_Y, 512 * 4);
 		*(uint32_t*)map = 0xbeef;
 
-- 
2.13.3



More information about the Intel-gfx mailing list