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

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


Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
---
 tests/i915/sysfs_heartbeat_interval.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/tests/i915/sysfs_heartbeat_interval.c b/tests/i915/sysfs_heartbeat_interval.c
index b8aba2416..1e56be8f9 100644
--- a/tests/i915/sysfs_heartbeat_interval.c
+++ b/tests/i915/sysfs_heartbeat_interval.c
@@ -39,6 +39,7 @@
 #include "igt_debugfs.h"
 #include "igt_dummyload.h"
 #include "igt_sysfs.h"
+#include "intel_allocator.h"
 #include "sw_sync.h"
 
 #define ATTR "heartbeat_interval_ms"
@@ -150,6 +151,7 @@ static uint64_t __test_timeout(int i915, int engine, unsigned int timeout)
 	igt_spin_t *spin[2];
 	uint64_t elapsed;
 	uint32_t ctx[2];
+	uint64_t ahnd[2];
 
 	igt_assert(igt_sysfs_scanf(engine, "class", "%u", &class) == 1);
 	igt_assert(igt_sysfs_scanf(engine, "instance", "%u", &inst) == 1);
@@ -157,15 +159,20 @@ static uint64_t __test_timeout(int i915, int engine, unsigned int timeout)
 	set_heartbeat(engine, timeout);
 
 	ctx[0] = create_context(i915, class, inst, 1023);
+	ahnd[0] = get_reloc_ahnd(i915, ctx[0]);
 	spin[0] = igt_spin_new(i915, ctx[0],
+			       .ahnd = ahnd[0],
 			       .flags = (IGT_SPIN_NO_PREEMPTION |
 					 IGT_SPIN_POLL_RUN |
 					 IGT_SPIN_FENCE_OUT));
 	igt_spin_busywait_until_started(spin[0]);
 
 	ctx[1] = create_context(i915, class, inst, -1023);
+	ahnd[1] = get_reloc_ahnd(i915, ctx[1]);
 	igt_nsec_elapsed(&ts);
-	spin[1] = igt_spin_new(i915, ctx[1], .flags = IGT_SPIN_POLL_RUN);
+	spin[1] = igt_spin_new(i915, ctx[1],
+			       .ahnd = ahnd[1],
+			       .flags = IGT_SPIN_POLL_RUN);
 	igt_spin_busywait_until_started(spin[1]);
 	elapsed = igt_nsec_elapsed(&ts);
 
@@ -179,6 +186,8 @@ static uint64_t __test_timeout(int i915, int engine, unsigned int timeout)
 	gem_context_destroy(i915, ctx[1]);
 	gem_context_destroy(i915, ctx[0]);
 	gem_quiescent_gpu(i915);
+	put_ahnd(ahnd[1]);
+	put_ahnd(ahnd[0]);
 
 	return elapsed;
 }
@@ -293,17 +302,20 @@ static void client(int i915, int engine, int *ctl, int duration, int expect)
 	unsigned int class, inst;
 	unsigned long count = 0;
 	uint32_t ctx;
+	uint64_t ahnd;
 
 	igt_assert(igt_sysfs_scanf(engine, "class", "%u", &class) == 1);
 	igt_assert(igt_sysfs_scanf(engine, "instance", "%u", &inst) == 1);
 
 	ctx = create_context(i915, class, inst, 0);
+	ahnd = get_reloc_ahnd(i915, ctx);
 
 	while (!READ_ONCE(*ctl)) {
 		unsigned int elapsed;
 		igt_spin_t *spin;
 
 		spin = igt_spin_new(i915, ctx,
+				    .ahnd = ahnd,
 				    .flags = (IGT_SPIN_NO_PREEMPTION |
 					      IGT_SPIN_POLL_RUN |
 					      IGT_SPIN_FENCE_OUT));
@@ -332,6 +344,7 @@ static void client(int i915, int engine, int *ctl, int duration, int expect)
 	}
 
 	gem_context_destroy(i915, ctx);
+	put_ahnd(ahnd);
 	igt_info("%s client completed %lu spins\n",
 		 expect < 0 ? "Bad" : "Good", count);
 }
@@ -355,6 +368,8 @@ static void __test_mixed(int i915, int engine,
 	 * terminate the hog leaving the good client to run.
 	 */
 
+	intel_allocator_multiprocess_start();
+
 	igt_assert(igt_sysfs_scanf(engine, ATTR, "%u", &saved) == 1);
 	igt_debug("Initial %s:%u\n", ATTR, saved);
 	gem_quiescent_gpu(i915);
@@ -379,6 +394,7 @@ static void __test_mixed(int i915, int engine,
 
 	gem_quiescent_gpu(i915);
 	set_heartbeat(engine, saved);
+	intel_allocator_multiprocess_stop();
 }
 
 static void test_mixed(int i915, int engine)
@@ -415,6 +431,7 @@ static void test_off(int i915, int engine)
 	unsigned int saved;
 	igt_spin_t *spin;
 	uint32_t ctx;
+	uint64_t ahnd;
 
 	/*
 	 * Some other clients request that there is never any interruption
@@ -434,8 +451,10 @@ static void test_off(int i915, int engine)
 	set_heartbeat(engine, 0);
 
 	ctx = create_context(i915, class, inst, 0);
+	ahnd = get_reloc_ahnd(i915, ctx);
 
 	spin = igt_spin_new(i915, ctx,
+			    .ahnd = ahnd,
 			    .flags = (IGT_SPIN_POLL_RUN |
 				      IGT_SPIN_NO_PREEMPTION |
 				      IGT_SPIN_FENCE_OUT));
@@ -452,6 +471,7 @@ static void test_off(int i915, int engine)
 	igt_assert_eq(sync_fence_status(spin->out_fence), -EIO);
 
 	igt_spin_free(i915, spin);
+	put_ahnd(ahnd);
 
 	gem_quiescent_gpu(i915);
 	set_heartbeat(engine, saved);
-- 
2.26.0



More information about the Intel-gfx-trybot mailing list