All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Ekstrand <jason@jlekstrand.net>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 43/79] tests/i915/gem_ctx_persistence: Convert to intel_ctx_t
Date: Thu, 17 Jun 2021 14:12:50 -0500	[thread overview]
Message-ID: <20210617191256.577244-44-jason@jlekstrand.net> (raw)
In-Reply-To: <20210617191256.577244-1-jason@jlekstrand.net>

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
---
 lib/intel_ctx.c                  |  13 ++
 lib/intel_ctx.h                  |   2 +
 tests/i915/gem_ctx_persistence.c | 223 ++++++++++++++++---------------
 3 files changed, 133 insertions(+), 105 deletions(-)

diff --git a/lib/intel_ctx.c b/lib/intel_ctx.c
index 4ababda8a..5ca8b4534 100644
--- a/lib/intel_ctx.c
+++ b/lib/intel_ctx.c
@@ -84,6 +84,7 @@ __context_create_cfg(int fd, const intel_ctx_cfg_t *cfg, uint32_t *ctx_id)
 	uint64_t ext_root = 0;
 	I915_DEFINE_CONTEXT_PARAM_ENGINES(engines, GEM_MAX_ENGINES);
 	struct drm_i915_gem_context_create_ext_setparam engines_param, vm_param;
+	struct drm_i915_gem_context_create_ext_setparam persist_param;
 	uint32_t i;
 
 	if (cfg->vm) {
@@ -99,6 +100,18 @@ __context_create_cfg(int fd, const intel_ctx_cfg_t *cfg, uint32_t *ctx_id)
 		add_user_ext(&ext_root, &vm_param.base);
 	}
 
+	if (cfg->nopersist) {
+		persist_param = (struct drm_i915_gem_context_create_ext_setparam) {
+			.base = {
+				.name = I915_CONTEXT_CREATE_EXT_SETPARAM,
+			},
+			.param = {
+				.param = I915_CONTEXT_PARAM_PERSISTENCE,
+			},
+		};
+		add_user_ext(&ext_root, &persist_param.base);
+	}
+
 	if (cfg->num_engines) {
 		memset(&engines, 0, sizeof(engines));
 		for (i = 0; i < cfg->num_engines; i++)
diff --git a/lib/intel_ctx.h b/lib/intel_ctx.h
index 054fecc4a..e34cefc14 100644
--- a/lib/intel_ctx.h
+++ b/lib/intel_ctx.h
@@ -16,6 +16,7 @@
  * intel_ctx_cfg_t:
  * @flags: Context create flags
  * @vm: VM to inherit or 0 for using a per-context VM
+ * @nopersist: set I915_CONTEXT_PARAM_PERSISTENCE to 0
  * @num_engines: Number of client-specified engines or 0 for legacy mode
  * @engines: Client-specified engines
  *
@@ -42,6 +43,7 @@
 typedef struct intel_ctx_cfg {
 	uint32_t flags;
 	uint32_t vm;
+	bool nopersist;
 	unsigned int num_engines;
 	struct i915_engine_class_instance engines[GEM_MAX_ENGINES];
 } intel_ctx_cfg_t;
diff --git a/tests/i915/gem_ctx_persistence.c b/tests/i915/gem_ctx_persistence.c
index 59077cc01..142bac28e 100644
--- a/tests/i915/gem_ctx_persistence.c
+++ b/tests/i915/gem_ctx_persistence.c
@@ -147,24 +147,32 @@ static void test_idempotent(int i915)
 	igt_assert_eq(p.value, expected);
 }
 
-static void test_persistence(int i915, unsigned int engine)
+static const intel_ctx_t *
+ctx_create_persistence(int i915, const intel_ctx_cfg_t *base_cfg, bool persist)
+{
+	intel_ctx_cfg_t cfg = *base_cfg;
+	cfg.nopersist = !persist;
+	return intel_ctx_create(i915, &cfg);
+}
+
+static void test_persistence(int i915, const intel_ctx_cfg_t *cfg,
+			     unsigned int engine)
 {
 	igt_spin_t *spin;
 	int64_t timeout;
-	uint32_t ctx;
+	const intel_ctx_t *ctx;
 
 	/*
 	 * Default behaviour are contexts remain alive until their last active
 	 * request is retired -- no early termination.
 	 */
 
-	ctx = gem_context_clone_with_engines(i915, 0);
-	gem_context_set_persistence(i915, ctx, true);
+	ctx = ctx_create_persistence(i915, cfg, true);
 
-	spin = igt_spin_new(i915, ctx,
+	spin = igt_spin_new(i915, .ctx = ctx,
 			    .engine = engine,
 			    .flags = IGT_SPIN_FENCE_OUT);
-	gem_context_destroy(i915, ctx);
+	intel_ctx_destroy(i915, ctx);
 
 	timeout = reset_timeout_ms * NSEC_PER_MSEC;
 	igt_assert_eq(gem_wait(i915, spin->handle, &timeout), -ETIME);
@@ -178,24 +186,24 @@ static void test_persistence(int i915, unsigned int engine)
 	igt_spin_free(i915, spin);
 }
 
-static void test_nonpersistent_cleanup(int i915, unsigned int engine)
+static void test_nonpersistent_cleanup(int i915, const intel_ctx_cfg_t *cfg,
+				       unsigned int engine)
 {
 	int64_t timeout = reset_timeout_ms * NSEC_PER_MSEC;
 	igt_spin_t *spin;
-	uint32_t ctx;
+	const intel_ctx_t *ctx;
 
 	/*
 	 * A nonpersistent context is terminated immediately upon closure,
 	 * any inflight request is cancelled.
 	 */
 
-	ctx = gem_context_clone_with_engines(i915, 0);
-	gem_context_set_persistence(i915, ctx, false);
+	ctx = ctx_create_persistence(i915, cfg, false);
 
-	spin = igt_spin_new(i915, ctx,
+	spin = igt_spin_new(i915, .ctx = ctx,
 			    .engine = engine,
 			    .flags = IGT_SPIN_FENCE_OUT);
-	gem_context_destroy(i915, ctx);
+	intel_ctx_destroy(i915, ctx);
 
 	igt_assert_eq(gem_wait(i915, spin->handle, &timeout), 0);
 	igt_assert_eq(sync_fence_status(spin->out_fence), -EIO);
@@ -203,7 +211,8 @@ static void test_nonpersistent_cleanup(int i915, unsigned int engine)
 	igt_spin_free(i915, spin);
 }
 
-static void test_nonpersistent_mixed(int i915, unsigned int engine)
+static void test_nonpersistent_mixed(int i915, const intel_ctx_cfg_t *cfg,
+				     unsigned int engine)
 {
 	int fence[3];
 
@@ -215,15 +224,14 @@ static void test_nonpersistent_mixed(int i915, unsigned int engine)
 
 	for (int i = 0; i < ARRAY_SIZE(fence); i++) {
 		igt_spin_t *spin;
-		uint32_t ctx;
+		const intel_ctx_t *ctx;
 
-		ctx = gem_context_clone_with_engines(i915, 0);
-		gem_context_set_persistence(i915, ctx, i & 1);
+		ctx = ctx_create_persistence(i915, cfg, i & 1);
 
-		spin = igt_spin_new(i915, ctx,
+		spin = igt_spin_new(i915, .ctx = ctx,
 				    .engine = engine,
 				    .flags = IGT_SPIN_FENCE_OUT);
-		gem_context_destroy(i915, ctx);
+		intel_ctx_destroy(i915, ctx);
 
 		fence[i] = spin->out_fence;
 	}
@@ -236,11 +244,12 @@ static void test_nonpersistent_mixed(int i915, unsigned int engine)
 	igt_assert_eq(sync_fence_wait(fence[1], 0), -ETIME);
 }
 
-static void test_nonpersistent_hostile(int i915, unsigned int engine)
+static void test_nonpersistent_hostile(int i915, const intel_ctx_cfg_t *cfg,
+				       unsigned int engine)
 {
 	int64_t timeout = reset_timeout_ms * NSEC_PER_MSEC;
 	igt_spin_t *spin;
-	uint32_t ctx;
+	const intel_ctx_t *ctx;
 
 	/*
 	 * If we cannot cleanly cancel the non-persistent context on closure,
@@ -248,24 +257,24 @@ static void test_nonpersistent_hostile(int i915, unsigned int engine)
 	 * the requests and cleanup the context.
 	 */
 
-	ctx = gem_context_clone_with_engines(i915, 0);
-	gem_context_set_persistence(i915, ctx, false);
+	ctx = ctx_create_persistence(i915, cfg, false);
 
-	spin = igt_spin_new(i915, ctx,
+	spin = igt_spin_new(i915, .ctx = ctx,
 			    .engine = engine,
 			    .flags = IGT_SPIN_NO_PREEMPTION);
-	gem_context_destroy(i915, ctx);
+	intel_ctx_destroy(i915, ctx);
 
 	igt_assert_eq(gem_wait(i915, spin->handle, &timeout), 0);
 
 	igt_spin_free(i915, spin);
 }
 
-static void test_nonpersistent_hostile_preempt(int i915, unsigned int engine)
+static void test_nonpersistent_hostile_preempt(int i915, const intel_ctx_cfg_t *cfg,
+					       unsigned int engine)
 {
 	int64_t timeout = reset_timeout_ms * NSEC_PER_MSEC;
 	igt_spin_t *spin[2];
-	uint32_t ctx;
+	const intel_ctx_t *ctx;
 
 	/*
 	 * Double plus ungood.
@@ -278,24 +287,22 @@ static void test_nonpersistent_hostile_preempt(int i915, unsigned int engine)
 
 	igt_require(gem_scheduler_has_preemption(i915));
 
-	ctx = gem_context_clone_with_engines(i915, 0);
-	gem_context_set_persistence(i915, ctx, true);
-	gem_context_set_priority(i915, ctx, 0);
-	spin[0] = igt_spin_new(i915, ctx,
+	ctx = ctx_create_persistence(i915, cfg, true);
+	gem_context_set_priority(i915, ctx->id, 0);
+	spin[0] = igt_spin_new(i915, .ctx = ctx,
 			       .engine = engine,
 			       .flags = (IGT_SPIN_NO_PREEMPTION |
 					 IGT_SPIN_POLL_RUN));
-	gem_context_destroy(i915, ctx);
+	intel_ctx_destroy(i915, ctx);
 
 	igt_spin_busywait_until_started(spin[0]);
 
-	ctx = gem_context_clone_with_engines(i915, 0);
-	gem_context_set_persistence(i915, ctx, false);
-	gem_context_set_priority(i915, ctx, 1); /* higher priority than 0 */
-	spin[1] = igt_spin_new(i915, ctx,
+	ctx = ctx_create_persistence(i915, cfg, false);
+	gem_context_set_priority(i915, ctx->id, 1); /* higher priority than 0 */
+	spin[1] = igt_spin_new(i915, .ctx = ctx,
 			       .engine = engine,
 			       .flags = IGT_SPIN_NO_PREEMPTION);
-	gem_context_destroy(i915, ctx);
+	intel_ctx_destroy(i915, ctx);
 
 	igt_assert_eq(gem_wait(i915, spin[1]->handle, &timeout), 0);
 
@@ -303,24 +310,24 @@ static void test_nonpersistent_hostile_preempt(int i915, unsigned int engine)
 	igt_spin_free(i915, spin[0]);
 }
 
-static void test_nonpersistent_hang(int i915, unsigned int engine)
+static void test_nonpersistent_hang(int i915, const intel_ctx_cfg_t *cfg,
+				    unsigned int engine)
 {
 	int64_t timeout = reset_timeout_ms * NSEC_PER_MSEC;
 	igt_spin_t *spin;
-	uint32_t ctx;
+	const intel_ctx_t *ctx;
 
 	/*
 	 * The user made a simple mistake and submitted an invalid batch,
 	 * but fortunately under a nonpersistent context. Do we detect it?
 	 */
 
-	ctx = gem_context_clone_with_engines(i915, 0);
-	gem_context_set_persistence(i915, ctx, false);
+	ctx = ctx_create_persistence(i915, cfg, false);
 
-	spin = igt_spin_new(i915, ctx,
+	spin = igt_spin_new(i915, .ctx = ctx,
 			    .engine = engine,
 			    .flags = IGT_SPIN_INVALID_CS);
-	gem_context_destroy(i915, ctx);
+	intel_ctx_destroy(i915, ctx);
 
 	igt_assert_eq(gem_wait(i915, spin->handle, &timeout), 0);
 
@@ -460,14 +467,16 @@ static void test_noheartbeat_many(int i915, int count, unsigned int flags)
 		igt_assert(set_heartbeat(i915, e->full_name, 500));
 
 		for (int n = 0; n < ARRAY_SIZE(spin); n++) {
-			uint32_t ctx;
+			const intel_ctx_t *ctx;
+
+			ctx = intel_ctx_create(i915, NULL);
 
-			ctx = gem_context_create(i915);
-			spin[n] = igt_spin_new(i915, ctx, .engine = eb_ring(e),
+			spin[n] = igt_spin_new(i915, .ctx = ctx,
+					       .engine = eb_ring(e),
 					       .flags = (IGT_SPIN_FENCE_OUT |
 							 IGT_SPIN_POLL_RUN |
 							 flags));
-			gem_context_destroy(i915, ctx);
+			intel_ctx_destroy(i915, ctx);
 		}
 		igt_spin_busywait_until_started(spin[0]);
 
@@ -504,7 +513,7 @@ static void test_noheartbeat_close(int i915, unsigned int flags)
 
 	for_each_physical_ring(e, i915) {
 		igt_spin_t *spin;
-		uint32_t ctx;
+		const intel_ctx_t *ctx;
 		int err;
 
 		if (!set_preempt_timeout(i915, e->full_name, 250))
@@ -513,15 +522,16 @@ static void test_noheartbeat_close(int i915, unsigned int flags)
 		if (!set_heartbeat(i915, e->full_name, 0))
 			continue;
 
-		ctx = gem_context_create(i915);
-		spin = igt_spin_new(i915, ctx, .engine = eb_ring(e),
+		ctx = intel_ctx_create(i915, NULL);
+		spin = igt_spin_new(i915, .ctx = ctx,
+				    .engine = eb_ring(e),
 				    .flags = (IGT_SPIN_FENCE_OUT |
 					      IGT_SPIN_POLL_RUN |
 					      flags));
 		igt_spin_busywait_until_started(spin);
 
 		igt_debug("Testing %s\n", e->full_name);
-		gem_context_destroy(i915, ctx);
+		intel_ctx_destroy(i915, ctx);
 		err = wait_for_status(spin->out_fence, reset_timeout_ms);
 
 		set_heartbeat(i915, e->full_name, 2500);
@@ -578,22 +588,22 @@ static void alarm_handler(int sig)
 {
 }
 
-static void test_nonpersistent_queued(int i915, unsigned int engine)
+static void test_nonpersistent_queued(int i915, const intel_ctx_cfg_t *cfg,
+				      unsigned int engine)
 {
 	struct sigaction old_sa, sa = { .sa_handler = alarm_handler };
 	struct itimerval itv;
 	igt_spin_t *spin;
 	int fence = -1;
-	uint32_t ctx;
+	const intel_ctx_t *ctx;
 
 	/*
 	 * Not only must the immediate batch be cancelled, but
 	 * all pending batches in the context.
 	 */
 
-	ctx = gem_context_clone_with_engines(i915, 0);
-	gem_context_set_persistence(i915, ctx, false);
-	spin = igt_spin_new(i915, ctx,
+	ctx = ctx_create_persistence(i915, cfg, false);
+	spin = igt_spin_new(i915, .ctx = ctx,
 			    .engine = engine,
 			    .flags = IGT_SPIN_FENCE_OUT);
 
@@ -621,7 +631,7 @@ static void test_nonpersistent_queued(int i915, unsigned int engine)
 	setitimer(ITIMER_REAL, &itv, NULL);
 	sigaction(SIGALRM, &old_sa, NULL);
 
-	gem_context_destroy(i915, ctx);
+	intel_ctx_destroy(i915, ctx);
 
 	igt_assert_eq(wait_for_status(spin->out_fence, reset_timeout_ms), -EIO);
 	igt_assert_eq(wait_for_status(fence, reset_timeout_ms), -EIO);
@@ -752,7 +762,8 @@ static void test_userptr(int i915)
 	gem_quiescent_gpu(i915);
 }
 
-static void test_process_mixed(int pfd, unsigned int engine)
+static void test_process_mixed(int pfd, const intel_ctx_cfg_t *cfg,
+			       unsigned int engine)
 {
 	int fence[2], sv[2];
 
@@ -772,13 +783,10 @@ static void test_process_mixed(int pfd, unsigned int engine)
 
 		for (int persists = 0; persists <= 1; persists++) {
 			igt_spin_t *spin;
-			uint32_t ctx;
-
-			ctx = gem_context_create(i915);
-			gem_context_copy_engines(pfd, 0, i915, ctx);
-			gem_context_set_persistence(i915, ctx, persists);
+			const intel_ctx_t *ctx;
 
-			spin = igt_spin_new(i915, ctx,
+			ctx = ctx_create_persistence(i915, cfg, persists);
+			spin = igt_spin_new(i915, .ctx = ctx,
 					    .engine = engine,
 					    .flags = IGT_SPIN_FENCE_OUT);
 
@@ -810,11 +818,12 @@ static void test_process_mixed(int pfd, unsigned int engine)
 }
 
 static void
-test_saturated_hostile(int i915, const struct intel_execution_engine2 *engine)
+test_saturated_hostile(int i915, const intel_ctx_t *base_ctx,
+		       const struct intel_execution_engine2 *engine)
 {
 	const struct intel_execution_engine2 *other;
 	igt_spin_t *spin;
-	uint32_t ctx;
+	const intel_ctx_t *ctx;
 	int fence = -1;
 
 	cleanup(i915);
@@ -831,11 +840,11 @@ test_saturated_hostile(int i915, const struct intel_execution_engine2 *engine)
 	 * reset other users whenever they chose.]
 	 */
 
-	__for_each_physical_engine(i915, other) {
+	for_each_ctx_engine(i915, base_ctx, other) {
 		if (other->flags == engine->flags)
 			continue;
 
-		spin = igt_spin_new(i915,
+		spin = igt_spin_new(i915, .ctx = base_ctx,
 				   .engine = other->flags,
 				   .flags = (IGT_SPIN_NO_PREEMPTION |
 					     IGT_SPIN_FENCE_OUT));
@@ -855,15 +864,14 @@ test_saturated_hostile(int i915, const struct intel_execution_engine2 *engine)
 	}
 	igt_require(fence != -1);
 
-	ctx = gem_context_clone_with_engines(i915, 0);
-	gem_context_set_persistence(i915, ctx, false);
-	spin = igt_spin_new(i915, ctx,
+	ctx = ctx_create_persistence(i915, &base_ctx->cfg, false);
+	spin = igt_spin_new(i915, .ctx = ctx,
 			    .engine = engine->flags,
 			    .flags = (IGT_SPIN_NO_PREEMPTION |
 				      IGT_SPIN_POLL_RUN |
 				      IGT_SPIN_FENCE_OUT));
 	igt_spin_busywait_until_started(spin);
-	gem_context_destroy(i915, ctx);
+	intel_ctx_destroy(i915, ctx);
 
 	/* Hostile request requires a GPU reset to terminate */
 	igt_assert_eq(wait_for_status(spin->out_fence, reset_timeout_ms), -EIO);
@@ -950,7 +958,7 @@ static void test_processes(int i915)
 	gem_quiescent_gpu(i915);
 }
 
-static void __smoker(int i915,
+static void __smoker(int i915, const intel_ctx_cfg_t *cfg,
 		     unsigned int engine,
 		     unsigned int timeout,
 		     int expected)
@@ -958,11 +966,12 @@ static void __smoker(int i915,
 	igt_spin_t *spin;
 	int fence = -1;
 	int fd, extra;
+	const intel_ctx_t *ctx;
 
 	fd = gem_reopen_driver(i915);
-	gem_context_copy_engines(i915, 0, fd, 0);
-	gem_context_set_persistence(fd, 0, expected > 0);
-	spin = igt_spin_new(fd, .engine = engine, .flags = IGT_SPIN_FENCE_OUT);
+	ctx = ctx_create_persistence(fd, cfg, expected > 0);
+	spin = igt_spin_new(fd, .ctx = ctx, .engine = engine,
+			    .flags = IGT_SPIN_FENCE_OUT);
 
 	extra = rand() % 8;
 	while (extra--) {
@@ -974,6 +983,8 @@ static void __smoker(int i915,
 		fence = spin->execbuf.rsvd2 >> 32;
 	}
 
+	intel_ctx_destroy(fd, ctx);
+
 	close(fd);
 	flush_delayed_fput(i915);
 
@@ -990,18 +1001,18 @@ static void __smoker(int i915,
 	igt_spin_free(fd, spin);
 }
 
-static void smoker(int i915,
+static void smoker(int i915, const intel_ctx_cfg_t *cfg,
 		   unsigned int engine,
 		   unsigned int timeout,
 		   unsigned int *ctl)
 {
 	while (!READ_ONCE(*ctl)) {
-		__smoker(i915, engine, timeout, -EIO);
-		__smoker(i915, engine, timeout, 1);
+		__smoker(i915, cfg, engine, timeout, -EIO);
+		__smoker(i915, cfg, engine, timeout, 1);
 	}
 }
 
-static void smoketest(int i915)
+static void smoketest(int i915, const intel_ctx_cfg_t *cfg)
 {
 	const int SMOKE_LOAD_FACTOR = 4;
 	const struct intel_execution_engine2 *e;
@@ -1021,9 +1032,9 @@ static void smoketest(int i915)
 		*ctl = 0;
 
 		igt_debug("Applying load factor: %d\n", i);
-		__for_each_physical_engine(i915, e) {
+		for_each_ctx_cfg_engine(i915, cfg, e) {
 			igt_fork(child, i)
-				smoker(i915,
+				smoker(i915, cfg,
 				       e->flags,
 				       i * reset_timeout_ms,
 				       ctl);
@@ -1038,7 +1049,7 @@ static void smoketest(int i915)
 	gem_quiescent_gpu(i915);
 }
 
-static void many_contexts(int i915)
+static void many_contexts(int i915, const intel_ctx_cfg_t *cfg)
 {
 	const struct intel_execution_engine2 *e;
 	int64_t timeout = NSEC_PER_SEC;
@@ -1059,17 +1070,16 @@ static void many_contexts(int i915)
 	igt_spin_reset(spin);
 
 	igt_until_timeout(30) {
-		__for_each_physical_engine(i915, e) {
-			uint32_t ctx;
+		for_each_ctx_cfg_engine(i915, cfg, e) {
+			const intel_ctx_t *ctx;
 
-			ctx = gem_context_clone_with_engines(i915, 0);
-			gem_context_set_persistence(i915, ctx, false);
+			ctx = ctx_create_persistence(i915, cfg, false);
 
-			spin->execbuf.rsvd1 = ctx;
+			spin->execbuf.rsvd1 = ctx->id;
 			spin->execbuf.flags &= ~63;
 			spin->execbuf.flags |= e->flags;
 			gem_execbuf(i915, &spin->execbuf);
-			gem_context_destroy(i915, ctx);
+			intel_ctx_destroy(i915, ctx);
 		}
 	}
 	igt_debugfs_dump(i915, "i915_engine_info");
@@ -1085,9 +1095,10 @@ static void many_contexts(int i915)
 	gem_quiescent_gpu(i915);
 }
 
-static void do_test(void (*test)(int i915, unsigned int engine),
-		    int i915, unsigned int engine,
-		    const char *name)
+static void do_test(void (*test)(int i915, const intel_ctx_cfg_t *cfg,
+				 unsigned int engine),
+		    int i915, const intel_ctx_cfg_t *cfg,
+		    unsigned int engine, const char *name)
 {
 #define ATTR "preempt_timeout_ms"
 	int timeout = -1;
@@ -1101,7 +1112,7 @@ static void do_test(void (*test)(int i915, unsigned int engine),
 		reset_timeout_ms = 200;
 	}
 
-	test(i915, engine);
+	test(i915, cfg, engine);
 
 	if (timeout != -1) {
 		gem_engine_property_printf(i915, name, ATTR, "%d", timeout);
@@ -1122,7 +1133,8 @@ igt_main
 {
 	struct {
 		const char *name;
-		void (*func)(int fd, unsigned int engine);
+		void (*func)(int fd, const intel_ctx_cfg_t *cfg,
+			     unsigned int engine);
 	} *test, tests[] = {
 		{ "persistence", test_persistence },
 		{ "cleanup", test_nonpersistent_cleanup },
@@ -1134,6 +1146,7 @@ igt_main
 		{ "hang", test_nonpersistent_hang },
 		{ NULL, NULL },
 	};
+	const intel_ctx_t *ctx;
 
 	igt_fixture {
 		i915 = drm_open_driver(DRIVER_INTEL);
@@ -1145,6 +1158,8 @@ igt_main
 		enable_hangcheck(i915);
 		igt_install_exit_handler(exit_handler);
 
+		ctx = intel_ctx_create_all_physical(i915);
+
 		igt_require(has_persistence(i915));
 		igt_allow_hang(i915, 0, 0);
 	}
@@ -1189,18 +1204,16 @@ igt_main
 		for (test = tests; test->name; test++) {
 			igt_subtest_with_dynamic_f("legacy-engines-%s",
 						   test->name) {
+				const intel_ctx_cfg_t empty_cfg = {};
 				for_each_physical_ring(e, i915) {
 					igt_dynamic_f("%s", e->name) {
-						do_test(test->func,
-							i915, eb_ring(e),
+						do_test(test->func, i915,
+							&empty_cfg, eb_ring(e),
 							e->full_name);
 					}
 				}
 			}
 		}
-
-		/* Assert things are under control. */
-		igt_assert(!gem_context_has_engine_map(i915, 0));
 	}
 
 	/* New way of selecting engines. */
@@ -1213,10 +1226,10 @@ igt_main
 
 		for (test = tests; test->name; test++) {
 			igt_subtest_with_dynamic_f("engines-%s", test->name) {
-				__for_each_physical_engine(i915, e) {
+				for_each_ctx_engine(i915, ctx, e) {
 					igt_dynamic_f("%s", e->name) {
-						do_test(test->func,
-							i915, e->flags,
+						do_test(test->func, i915,
+							&ctx->cfg, e->flags,
 							e->name);
 					}
 				}
@@ -1224,17 +1237,17 @@ igt_main
 		}
 
 		igt_subtest_with_dynamic_f("saturated-hostile") {
-			__for_each_physical_engine(i915, e) {
+			for_each_ctx_engine(i915, ctx, e) {
 				igt_dynamic_f("%s", e->name)
-					test_saturated_hostile(i915, e);
+					test_saturated_hostile(i915, ctx, e);
 			}
 		}
 
 		igt_subtest("many-contexts")
-			many_contexts(i915);
+			many_contexts(i915, &ctx->cfg);
 
 		igt_subtest("smoketest")
-			smoketest(i915);
+			smoketest(i915, &ctx->cfg);
 	}
 
 	igt_fixture {
-- 
2.31.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2021-06-17 19:14 UTC|newest]

Thread overview: 141+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-17 19:12 [igt-dev] [PATCH i-g-t 00/79] Stop depending on context mutation (v4) Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 01/79] lib/i915/gem_submission_measure: Take an optional intel_ctx_cfg_t Jason Ekstrand
2021-06-18  3:42   ` Dixit, Ashutosh
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 02/79] tests/i915/gem_exec_fence: Move the engine data into inter_engine_context (v3) Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 03/79] tests/i915/gem_exec_fence: Convert to intel_ctx_t (v2) Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 04/79] tests/i915/gem_exec_schedule: " Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 05/79] tests/i915/perf_pmu: Convert to intel_ctx_t (v3) Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 06/79] tests/i915/gem_exec_nop: Convert to intel_ctx_t Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 07/79] tests/i915/gem_exec_reloc: Convert to intel_ctx_t (v3) Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 08/79] tests/i915/gem_busy: " Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 09/79] tests/i915/gem_ctx_isolation: Convert to intel_ctx_t (v2) Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 10/79] tests/i915/gem_exec_async: " Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 11/79] tests/i915/sysfs_clients: Convert to intel_ctx_t Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 12/79] tests/i915/gem_exec_fair: " Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 13/79] tests/i915/gem_spin_batch: Convert to intel_ctx_t (v2) Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 14/79] tests/i915/gem_exec_store: " Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 15/79] tests/amdgpu/amd_prime: Convert to intel_ctx_t Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 16/79] tests/i915/i915_hangman: Convert to intel_ctx_t (v2) Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 17/79] tests/i915/gem_ringfill: Convert to intel_ctx_t Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 18/79] tests/prime_busy: " Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 19/79] tests/prime_vgem: Convert to intel_ctx_t (v2) Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 20/79] tests/gem_exec_whisper: " Jason Ekstrand
2021-06-17 20:48   ` Dixit, Ashutosh
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 21/79] tests/i915/gem_ctx_exec: Stop cloning contexts in close_race Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 22/79] tests/i915/gem_ctx_exec: Convert to intel_ctx_t Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 23/79] tests/i915/gem_exec_suspend: Convert to intel_ctx_t (v2) Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 24/79] tests/i915/gem_sync: " Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 25/79] tests/i915/gem_userptr_blits: Convert to intel_ctx_t Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 26/79] tests/i915/gem_wait: Convert to intel_ctx_t (v2) Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 27/79] tests/i915/gem_request_retire: Convert to intel_ctx_t Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 28/79] tests/i915/gem_ctx_shared: Convert to intel_ctx_t (v2) Jason Ekstrand
2021-06-17 22:06   ` Dixit, Ashutosh
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 29/79] tests/i915/gem_ctx_shared: Stop cloning contexts Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 30/79] tests/i915/gem_create: Convert to intel_ctx_t Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 31/79] tests/i915/gem_ctx_switch: " Jason Ekstrand
2021-06-18  4:55   ` Dixit, Ashutosh
2021-06-18 16:35     ` Jason Ekstrand
2021-06-18 16:47   ` [igt-dev] [PATCH i-g-t] " Jason Ekstrand
2021-06-18 19:19     ` Dixit, Ashutosh
2021-06-21  3:48       ` Jason Ekstrand
2021-06-21  5:28         ` Dixit, Ashutosh
2021-06-23  5:31           ` Jason Ekstrand
2021-06-24  2:34             ` Dixit, Ashutosh
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 32/79] tests/i915/gem_exec_parallel: Convert to intel_ctx_t (v2) Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 33/79] tests/i915/gem_exec_latency: Convert to intel_ctx_t (v3) Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 34/79] tests/i915/gem_watchdog: Convert to intel_ctx_t (v2) Jason Ekstrand
2021-06-18  7:17   ` Dixit, Ashutosh
2021-06-18 16:22     ` Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 35/79] tests/i915/gem_shrink: Convert to intel_ctx_t (v4) Jason Ekstrand
2021-06-18  6:04   ` Zbigniew Kempczyński
2021-06-18 16:08     ` Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 36/79] tests/i915/gem_exec_params: Convert to intel_ctx_t Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 37/79] tests/i915/gem_exec_gttfill: Convert to intel_ctx_t (v2) Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 38/79] tests/i915/gem_exec_capture: " Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 39/79] tests/i915/gem_exec_create: Convert to intel_ctx_t Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 40/79] tests/i915/gem_exec_await: Convert to intel_ctx_t (v2) Jason Ekstrand
2021-06-22  0:14   ` Dixit, Ashutosh
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 41/79] tests/i915/gem_ctx_persistence: Drop the clone subtest Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 42/79] tests/i915/gem_ctx_persistence: Drop the engine replace subtests Jason Ekstrand
2021-06-17 19:12 ` Jason Ekstrand [this message]
2021-06-22  1:51   ` [igt-dev] [PATCH i-g-t 43/79] tests/i915/gem_ctx_persistence: Convert to intel_ctx_t Dixit, Ashutosh
2021-06-23  5:38     ` Jason Ekstrand
2021-06-24  1:56       ` Dixit, Ashutosh
2021-06-30 17:49         ` Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 44/79] tests/i915/module_load: " Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 45/79] tests/i915/pm_rc6_residency: " Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 46/79] tests/i915/gem_cs_tlb: " Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 47/79] tests/core_hotplug: " Jason Ekstrand
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 48/79] tests/i915/gem_exec_balancer: Stop cloning engines Jason Ekstrand
2021-06-25 22:26   ` Dixit, Ashutosh
2021-06-17 19:12 ` [igt-dev] [PATCH i-g-t 49/79] tests/i915/gem_exec_balancer: Don't reset engines on a context Jason Ekstrand
2021-06-29  3:53   ` Dixit, Ashutosh
2021-07-06  5:23     ` Dixit, Ashutosh
2021-07-07 14:24     ` Jason Ekstrand
2021-06-17 19:14 ` [igt-dev] [PATCH i-g-t 50/79] tests/i915/gem_exec_balancer: Stop munging ctx0 engines Jason Ekstrand
2021-06-25 23:11   ` Dixit, Ashutosh
2021-06-17 19:14 ` [igt-dev] [PATCH i-g-t 51/79] tests/i915/gem_exec_balancer: Drop bonded tests Jason Ekstrand
2021-06-25 21:25   ` Dixit, Ashutosh
2021-06-17 19:14 ` [igt-dev] [PATCH i-g-t 52/79] lib/intel_ctx: Add load balancing support (v2) Jason Ekstrand
2021-06-17 19:14 ` [igt-dev] [PATCH i-g-t 53/79] tests/i915/gem_exec_balancer: Convert to intel_ctx_t Jason Ekstrand
2021-06-28 21:23   ` Dixit, Ashutosh
2021-06-17 19:14 ` [igt-dev] [PATCH i-g-t 54/79] tests/i915/gem_exec_endless: Stop munging ctx0 engines Jason Ekstrand
2021-06-17 19:14 ` [igt-dev] [PATCH i-g-t 55/79] lib/i915/submission: Rework gem_test_all_engines to use intel_ctx_t Jason Ekstrand
2021-06-18  1:16   ` Dixit, Ashutosh
2021-06-18 16:03     ` Jason Ekstrand
2021-06-17 19:14 ` [igt-dev] [PATCH i-g-t 56/79] lib/i915: Require a context config in gem_submission_measure Jason Ekstrand
2021-06-18  3:44   ` Dixit, Ashutosh
2021-06-17 19:14 ` [igt-dev] [PATCH i-g-t 57/79] tests/i915/gem_ctx_engines: Rework execute-one* Jason Ekstrand
2021-06-23  1:14   ` Dixit, Ashutosh
2021-06-17 19:14 ` [igt-dev] [PATCH i-g-t 58/79] tests/i915/gem_ctx_engines: Use better engine iteration Jason Ekstrand
2021-06-22 21:47   ` Dixit, Ashutosh
2021-06-17 19:14 ` [igt-dev] [PATCH i-g-t 59/79] tests/i915/gem_ctx_engines: Drop the idempotent subtest Jason Ekstrand
2021-06-22 19:35   ` Dixit, Ashutosh
2021-06-17 19:14 ` [igt-dev] [PATCH i-g-t 60/79] tests/i915/gem_ctx_create: Convert benchmarks to intel_ctx_t Jason Ekstrand
2021-06-22  3:30   ` Dixit, Ashutosh
2021-06-23  6:09     ` Jason Ekstrand
2021-06-24  2:07       ` Dixit, Ashutosh
2021-07-07 13:51         ` Jason Ekstrand
2021-07-08  6:23       ` Zbigniew Kempczyński
2021-06-17 19:14 ` [igt-dev] [PATCH i-g-t 61/79] tests/i915/gem_vm_create: Delete destroy racing tests Jason Ekstrand
2021-06-22  2:07   ` Dixit, Ashutosh
2021-06-17 19:14 ` [igt-dev] [PATCH i-g-t 62/79] tests/i915/gem_vm_create: Use intel_ctx_t in the execbuf test Jason Ekstrand
2021-06-22  2:17   ` Dixit, Ashutosh
2021-06-23  5:43     ` Jason Ekstrand
2021-06-17 19:15 ` [igt-dev] [PATCH i-g-t 63/79] tests/i915/sysfs: Convert to intel_ctx_t Jason Ekstrand
2021-06-17 19:15 ` [igt-dev] [PATCH i-g-t 64/79] tests/i915/gem_workarounds: " Jason Ekstrand
2021-06-17 19:15 ` [igt-dev] [PATCH i-g-t 65/79] lib/i915/gem_context: Delete all the context clone/copy stuff Jason Ekstrand
2021-06-28 20:16   ` Dixit, Ashutosh
2021-06-30 18:00     ` Jason Ekstrand
2021-06-17 19:15 ` [igt-dev] [PATCH i-g-t 66/79] tests/i915/gem_ctx_engines: Delete the libapi subtest Jason Ekstrand
2021-06-22  2:24   ` Dixit, Ashutosh
2021-06-17 19:15 ` [igt-dev] [PATCH i-g-t 67/79] lib/igt_dummyload: Stop supporting ALL_ENGINES without an intel_ctx_t Jason Ekstrand
2021-06-17 19:15 ` [igt-dev] [PATCH i-g-t 68/79] lib/i915/gem_engine_topology: Delete the old physical engine iterators Jason Ekstrand
2021-06-17 19:15 ` [igt-dev] [PATCH i-g-t 69/79] tests/i915/gem_mmap_gtt: Convert to intel_ctx_t Jason Ekstrand
2021-06-22  2:33   ` Dixit, Ashutosh
2021-06-17 19:15 ` [igt-dev] [PATCH i-g-t 70/79] igt/dummyload: Require an intel_ctx_t for POLL_RUN and !ALL_ENGINES Jason Ekstrand
2021-06-17 19:15 ` [igt-dev] [PATCH i-g-t 71/79] lib/i915: Rework engine API availability checks (v2) Jason Ekstrand
2021-06-28 19:56   ` Dixit, Ashutosh
2021-06-30 17:57     ` Jason Ekstrand
2021-06-30 21:31       ` Dixit, Ashutosh
2021-07-07 14:27         ` Jason Ekstrand
2021-06-17 19:15 ` [igt-dev] [PATCH i-g-t 72/79] lib/intel_bb: Remove intel_bb_assign_vm and tests (v2) Jason Ekstrand
2021-06-17 19:15 ` [igt-dev] [PATCH i-g-t 73/79] tests/i915/gem_ctx_param: Stop setting VMs on old contexts Jason Ekstrand
2021-06-23  3:02   ` Dixit, Ashutosh
2021-06-17 19:15 ` [igt-dev] [PATCH i-g-t 74/79] tests/i915/gen9_exec_parse: Convert to intel_ctx_t Jason Ekstrand
2021-06-22  2:56   ` Dixit, Ashutosh
2021-06-17 19:15 ` [igt-dev] [PATCH i-g-t 75/79] tests/i915/gem_ctx_param: Add tests for recently removed params Jason Ekstrand
2021-06-23  3:18   ` Dixit, Ashutosh
2021-06-17 19:15 ` [igt-dev] [PATCH i-g-t 76/79] tests/i915/gem_ctx_param: Add a couple invalid PARAM_VM cases Jason Ekstrand
2021-06-23  3:10   ` Dixit, Ashutosh
2021-06-17 19:15 ` [igt-dev] [PATCH i-g-t 77/79] tests/i915/gem_ctx_engines: Fix the invalid subtest for the new rules Jason Ekstrand
2021-06-23  0:04   ` Dixit, Ashutosh
2021-06-17 19:15 ` [igt-dev] [PATCH i-g-t 78/79] tests/i915/gem_exec_balancer: Fix invalid-balancer for the set-once rule Jason Ekstrand
2021-06-26  0:48   ` Dixit, Ashutosh
2021-06-30 17:43     ` Jason Ekstrand
2021-06-17 19:15 ` [igt-dev] [PATCH i-g-t 79/79] tests/i915/gem_exec_balancer: Add a test for combind balancing and bonding (v2) Jason Ekstrand
2021-06-26  1:52   ` Dixit, Ashutosh
2021-06-17 20:01 ` [igt-dev] ✓ Fi.CI.BAT: success for Stop depending on context mutation (rev12) Patchwork
2021-06-17 21:06 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2021-06-18 18:45 ` [igt-dev] ✓ Fi.CI.BAT: success for Stop depending on context mutation (rev13) Patchwork
2021-06-18 21:31 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210617191256.577244-44-jason@jlekstrand.net \
    --to=jason@jlekstrand.net \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.