[PATCH i-g-t 2/3] WIP: gem_busy

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Mon Apr 19 18:59:41 UTC 2021


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

diff --git a/tests/i915/gem_busy.c b/tests/i915/gem_busy.c
index 77a551013..4f8b7de05 100644
--- a/tests/i915/gem_busy.c
+++ b/tests/i915/gem_busy.c
@@ -35,6 +35,18 @@
 /* Exercise the busy-ioctl, ensuring the ABI is never broken */
 IGT_TEST_DESCRIPTION("Basic check of busy-ioctl ABI.");
 
+static uint64_t get_ahnd(int fd)
+{
+	bool do_relocs = gem_has_relocations(fd);
+
+	return do_relocs ? 0 : intel_allocator_open(fd, 0, INTEL_ALLOCATOR_RELOC);
+}
+
+static bool put_ahnd(uint64_t ahnd)
+{
+	return !ahnd || intel_allocator_close(ahnd);
+}
+
 enum { TEST = 0, BUSY, BATCH };
 
 static bool gem_busy(int fd, uint32_t handle)
@@ -165,8 +177,10 @@ static void one(int fd, const struct intel_execution_engine2 *e, unsigned test_f
 	struct timespec tv;
 	igt_spin_t *spin;
 	int timeout;
+	uint64_t ahnd = get_ahnd(fd);
 
 	spin = igt_spin_new(fd,
+			    .ahnd = ahnd,
 			    .engine = e->flags,
 			    .dependency = scratch,
 			    .flags = (test_flags & HANG) ? IGT_SPIN_NO_PREEMPTION : 0);
@@ -218,6 +232,7 @@ static void one(int fd, const struct intel_execution_engine2 *e, unsigned test_f
 
 	igt_spin_free(fd, spin);
 	gem_close(fd, scratch);
+	put_ahnd(ahnd);
 }
 
 static void xchg_u32(void *array, unsigned i, unsigned j)
@@ -345,19 +360,23 @@ static bool has_semaphores(int fd)
 
 static bool has_extended_busy_ioctl(int fd)
 {
-	igt_spin_t *spin = igt_spin_new(fd, .engine = I915_EXEC_DEFAULT);
+	uint64_t ahnd = get_ahnd(fd);
+	igt_spin_t *spin = igt_spin_new(fd, .ahnd = ahnd, .engine = I915_EXEC_DEFAULT);
 	uint32_t read, write;
 
 	__gem_busy(fd, spin->handle, &read, &write);
 	igt_spin_free(fd, spin);
+	put_ahnd(ahnd);
 
 	return read != 0;
 }
 
 static void basic(int fd, const struct intel_execution_engine2 *e, unsigned flags)
 {
+	uint64_t ahnd = get_ahnd(fd);
 	igt_spin_t *spin =
 		igt_spin_new(fd,
+			     .ahnd = ahnd,
 			     .engine = e->flags,
 			     .flags = flags & HANG ?
 			     IGT_SPIN_NO_PREEMPTION | IGT_SPIN_INVALID_CS : 0);
@@ -382,6 +401,7 @@ static void basic(int fd, const struct intel_execution_engine2 *e, unsigned flag
 	}
 
 	igt_spin_free(fd, spin);
+	put_ahnd(ahnd);
 }
 
 static void all(int i915)
@@ -419,8 +439,10 @@ igt_main
 
 		igt_subtest_with_dynamic("busy") {
 			igt_dynamic("all") {
+				intel_allocator_multiprocess_start();
 				gem_quiescent_gpu(fd);
 				all(fd);
+				intel_allocator_multiprocess_stop();
 			}
 
 			__for_each_physical_engine(fd, e) {
-- 
2.26.0



More information about the Intel-gfx-trybot mailing list