[PATCH i-g-t 28/58] tests/gem_vm_create: Adopt to use no-reloc

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Tue Jul 6 07:09:05 UTC 2021


Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
---
 tests/i915/gem_vm_create.c | 29 ++++++++++++++++++++++++++---
 1 file changed, 26 insertions(+), 3 deletions(-)

diff --git a/tests/i915/gem_vm_create.c b/tests/i915/gem_vm_create.c
index 70b43dc6d..31f5aff3f 100644
--- a/tests/i915/gem_vm_create.c
+++ b/tests/i915/gem_vm_create.c
@@ -362,8 +362,10 @@ static void async_destroy(int i915)
 	};
 	igt_spin_t *spin[2];
 	int err;
+	uint64_t ahnd = get_reloc_ahnd(i915, arg.ctx_id);
 
 	spin[0] = igt_spin_new(i915,
+			       .ahnd = ahnd,
 			       .ctx_id = arg.ctx_id,
 			       .flags = IGT_SPIN_POLL_RUN);
 	igt_spin_busywait_until_started(spin[0]);
@@ -373,7 +375,7 @@ static void async_destroy(int i915)
 		err = 0;
 	igt_assert_eq(err, 0);
 
-	spin[1] = __igt_spin_new(i915, .ctx_id = arg.ctx_id);
+	spin[1] = __igt_spin_new(i915, .ahnd = ahnd, .ctx_id = arg.ctx_id);
 
 	igt_spin_end(spin[0]);
 	gem_sync(i915, spin[0]->handle);
@@ -386,15 +388,19 @@ static void async_destroy(int i915)
 
 	for (int i = 0; i < ARRAY_SIZE(spin); i++)
 		igt_spin_free(i915, spin[i]);
+	put_ahnd(ahnd);
 }
 
 static void destroy_race(int i915)
 {
 	const int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
 	uint32_t *vm;
+	uint64_t ahnd = get_reloc_ahnd(i915, 0);
 
 	/* Check we can execute a polling spinner */
-	igt_spin_free(i915, igt_spin_new(i915, .flags = IGT_SPIN_POLL_RUN));
+	igt_spin_free(i915, igt_spin_new(i915,
+					 .ahnd = ahnd,
+					 .flags = IGT_SPIN_POLL_RUN));
 
 	vm = mmap(NULL, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
 	igt_assert(vm != MAP_FAILED);
@@ -406,7 +412,10 @@ static void destroy_race(int i915)
 		uint32_t ctx = gem_context_create(i915);
 		igt_spin_t *spin;
 
-		spin = __igt_spin_new(i915, ctx, .flags = IGT_SPIN_POLL_RUN);
+		ahnd = get_reloc_ahnd(i915, ctx);
+		spin = __igt_spin_new(i915, ctx,
+				      .ahnd = ahnd,
+				      .flags = IGT_SPIN_POLL_RUN);
 		while (!READ_ONCE(vm[ncpus])) {
 			struct drm_i915_gem_context_param arg = {
 				.ctx_id = ctx,
@@ -419,6 +428,7 @@ static void destroy_race(int i915)
 				continue;
 
 			nxt = __igt_spin_new(i915, ctx,
+					     .ahnd = ahnd,
 					     .flags = IGT_SPIN_POLL_RUN);
 
 			igt_spin_end(spin);
@@ -432,6 +442,7 @@ static void destroy_race(int i915)
 
 		igt_spin_free(i915, spin);
 		gem_context_destroy(i915, ctx);
+		put_ahnd(ahnd);
 	}
 
 	igt_until_timeout(5) {
@@ -447,6 +458,7 @@ static void destroy_race(int i915)
 
 	for (int child = 0; child < ncpus; child++)
 		gem_vm_destroy(i915, vm[child]);
+	put_ahnd(ahnd);
 
 	munmap(vm, 4096);
 }
@@ -483,9 +495,20 @@ igt_main
 
 		igt_subtest("async-destroy")
 			async_destroy(i915);
+	}
+
+	igt_subtest_group {
+		igt_fixture {
+			gem_context_require_param(i915, I915_CONTEXT_PARAM_VM);
+			intel_allocator_multiprocess_start();
+		}
 
 		igt_subtest("destroy-race")
 			destroy_race(i915);
+
+		igt_fixture {
+			intel_allocator_multiprocess_stop();
+		}
 	}
 
 	igt_fixture {
-- 
2.26.0



More information about the Intel-gfx-trybot mailing list