[PATCH i-g-t] tests/gem_userptr_blits: Add active variant of mmap-offset-invalidate
Janusz Krzysztofik
janusz.krzysztofik at linux.intel.com
Tue Feb 25 17:56:30 UTC 2020
Suggested-by: Chris Wilson <chris at chris-wilson.co.uk>
Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik at linux.intel.com>
---
tests/i915/gem_userptr_blits.c | 40 ++++++++++++++++++++++++++++------
1 file changed, 33 insertions(+), 7 deletions(-)
diff --git a/tests/i915/gem_userptr_blits.c b/tests/i915/gem_userptr_blits.c
index cd1a3af27..f36ad5422 100644
--- a/tests/i915/gem_userptr_blits.c
+++ b/tests/i915/gem_userptr_blits.c
@@ -797,10 +797,13 @@ static int test_map_fixed_invalidate(int fd, uint32_t flags)
return 0;
}
-static void test_mmap_offset_invalidate(int fd, const struct mmap_offset *t)
+static void test_mmap_offset_invalidate(int fd, const struct mmap_offset *t,
+ int flags)
+#define MMOI_ACTIVE 0x1
{
void *ptr, *map;
uint32_t handle;
+ igt_spin_t *spin;
/* check if mmap_offset type is supported by hardware, skip if not */
handle = gem_create(fd, PAGE_SIZE);
@@ -818,15 +821,31 @@ static void test_mmap_offset_invalidate(int fd, const struct mmap_offset *t)
/* set up mmap-offset mapping on top of the object, skip if refused */
map = __gem_mmap_offset(fd, handle, 0, PAGE_SIZE,
PROT_READ | PROT_WRITE, t->type);
- igt_require_f(map, "mmap-offset banned, lockdep loop prevention\n");
-
- /* set object pages in order to activate MMU notifier for it */
- gem_set_domain(fd, handle, t->domain, t->domain);
+ igt_skip_on_f(!map && errno == ENODEV,
+ "mmap-offset(%s) banned, lockdep loop prevention\n",
+ t->name);
+ igt_assert(map);
+
+ /* activate MMU notifier for the object */
+ if (flags & MMOI_ACTIVE) {
+ /* attach a time limited dummy load to the object */
+ spin = igt_spin_new(fd, .dependency = handle);
+ usleep(USEC_PER_SEC);
+ igt_spin_set_timeout(spin, NSEC_PER_SEC);
+ } else {
+ /* just set object pages */
+ gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT,
+ I915_GEM_DOMAIN_GTT);
+ }
/* trigger the notifier */
+ igt_set_timeout(2, "deadlock");
munmap(ptr, PAGE_SIZE);
+ igt_reset_timeout();
/* cleanup */
+ if (flags & MMOI_ACTIVE)
+ igt_spin_free(fd, spin);
munmap(map, PAGE_SIZE);
gem_close(fd, handle);
}
@@ -2204,11 +2223,18 @@ igt_main_args("c:", NULL, help_str, opt_handler, NULL)
}
}
- igt_describe("Invalidate pages of userptr with mmap-offset on top");
+ igt_describe("Invalidate pages of idle userptr with mmap-offset on top");
igt_subtest_with_dynamic("mmap-offset-invalidate")
for_each_mmap_offset_type(fd, t)
igt_dynamic_f("%s", t->name)
- test_mmap_offset_invalidate(fd, t);
+ test_mmap_offset_invalidate(fd, t, 0);
+
+ igt_describe("Invalidate pages of active userptr with mmap-offset on top");
+ igt_subtest_with_dynamic("mmap-offset-invalidate-active")
+ for_each_mmap_offset_type(fd, t)
+ igt_dynamic_f("%s", t->name)
+ test_mmap_offset_invalidate(fd, t,
+ MMOI_ACTIVE);
igt_subtest("coherency-sync")
test_coherency(fd, count);
--
2.21.1
More information about the Intel-gfx-trybot
mailing list