[igt-dev] [RFC i-g-t v2 3/4] tests/i915/gem_exec_gttfill: extend basic subtest for multigpu

Kamil Konieczny kamil.konieczny at linux.intel.com
Fri Oct 7 18:49:01 UTC 2022


Allow basic subtest to run on more than one gpu in parallel.

Cc: Anna Karas <anna.karas at intel.com>
Cc: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
Cc: Mauro Carvalho Chehab <mauro.chehab at linux.intel.com>
Cc: Petri Latvala <petri.latvala at intel.com>
Signed-off-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
---
 tests/i915/gem_exec_gttfill.c | 48 +++++++++++++++++++++++++++++++----
 1 file changed, 43 insertions(+), 5 deletions(-)

diff --git a/tests/i915/gem_exec_gttfill.c b/tests/i915/gem_exec_gttfill.c
index f9f244d6..c3d3d3a0 100644
--- a/tests/i915/gem_exec_gttfill.c
+++ b/tests/i915/gem_exec_gttfill.c
@@ -222,27 +222,59 @@ static void fillgtt(int fd, const intel_ctx_t *ctx, unsigned ring, int timeout)
 	igt_assert_eq(intel_detect_and_clear_missed_interrupts(fd), 0);
 }
 
+static const intel_ctx_t *start_helpers(int i915)
+{
+	const intel_ctx_t *ctx;
+
+	igt_require(i915 > 0);
+	igt_require_gem(i915);
+	ctx = intel_ctx_create_all_physical(i915);
+	igt_fork_hang_detector(i915);
+
+	return ctx;
+}
+
 igt_main
 {
 	const struct intel_execution_engine2 *e;
 	const intel_ctx_t *ctx;
 	int i915 = -1;
+	int gpu_count = 2;
 
 	igt_fixture {
 		i915 = drm_open_driver(DRIVER_INTEL);
 		igt_require_gem(i915);
-		ctx = intel_ctx_create_all_physical(i915);
-		igt_fork_hang_detector(i915);
+		//ctx = intel_ctx_create_all_physical(i915);
+		//igt_fork_hang_detector(i915);
 		intel_allocator_multiprocess_start();
 	}
 
 	igt_describe("Checks if it can handle enough batches to fill gtt");
+#if 0
 	igt_subtest("basic") /* just enough to run a single pass */
 		fillgtt(i915, ctx, ALL_ENGINES, 1);
+#endif
+#define myname "basic"
+
+	igt_subtest_with_dynamic(myname)
+	for (int j__ = 1, size__ = gpu_count; j__; igt_waitchildren_dyn(), j__ = 0)
+	igt_fork_dyn(child, size__)
+	igt_dynamic_f("%s-gpu-%d", myname, child) {
+		int gpu_fd;
+
+		gpu_fd = __drm_open_driver_another(child, DRIVER_INTEL);
+		/* prepare */
+		ctx = start_helpers(gpu_fd);
+		/* run dynamic subtest */
+		fillgtt(gpu_fd, ctx, ALL_ENGINES, 1);
+		igt_stop_hang_detector();
+		intel_ctx_destroy(gpu_fd, ctx);
+	}
 
 	igt_describe("Checks the correctness of handling enough batches "
 		     "to fill gtt for each engine");
 	igt_subtest_with_dynamic("engines") {
+		ctx = start_helpers(i915);
 		for_each_ctx_engine(i915, ctx, e) {
 			if (!gem_class_can_store_dword(i915, e->class))
 				continue;
@@ -250,17 +282,23 @@ igt_main
 			igt_dynamic_f("%s", e->name)
 				fillgtt(i915, ctx, e->flags, 20);
 		}
+		igt_stop_hang_detector();
+		intel_ctx_destroy(i915, ctx);
 	}
 
 	igt_describe("Stress test check behaviour/correctness of handling"
 		     " batches to fill gtt");
-	igt_subtest("all")
+	igt_subtest("all") {
+		ctx = start_helpers(i915);
 		fillgtt(i915, ctx, ALL_ENGINES, 20);
+		igt_stop_hang_detector();
+		intel_ctx_destroy(i915, ctx);
+	}
 
 	igt_fixture {
 		intel_allocator_multiprocess_stop();
-		igt_stop_hang_detector();
-		intel_ctx_destroy(i915, ctx);
+		//igt_stop_hang_detector();
+		//intel_ctx_destroy(i915, ctx);
 		close(i915);
 	}
 }
-- 
2.34.1



More information about the igt-dev mailing list