All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] drm/i915/selftests: Split preemption smoke test into threads
@ 2018-10-01 12:32 Chris Wilson
  2018-10-01 12:32 ` [PATCH 2/4] drm/i915/selftests: Include arbitration points in preemption smoketest Chris Wilson
                   ` (6 more replies)
  0 siblings, 7 replies; 12+ messages in thread
From: Chris Wilson @ 2018-10-01 12:32 UTC (permalink / raw)
  To: intel-gfx

When submitting chains to each engine, we can do so (mostly) in
parallel, so delegate submission to threads on a per-engine basis.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/selftests/intel_lrc.c | 73 ++++++++++++++++++----
 1 file changed, 61 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/i915/selftests/intel_lrc.c b/drivers/gpu/drm/i915/selftests/intel_lrc.c
index 3a474bb64c05..d68a924c530e 100644
--- a/drivers/gpu/drm/i915/selftests/intel_lrc.c
+++ b/drivers/gpu/drm/i915/selftests/intel_lrc.c
@@ -587,8 +587,10 @@ static int random_priority(struct rnd_state *rnd)
 struct preempt_smoke {
 	struct drm_i915_private *i915;
 	struct i915_gem_context **contexts;
+	struct intel_engine_cs *engine;
 	unsigned int ncontext;
 	struct rnd_state prng;
+	unsigned long count;
 };
 
 static struct i915_gem_context *smoke_context(struct preempt_smoke *smoke)
@@ -597,31 +599,78 @@ static struct i915_gem_context *smoke_context(struct preempt_smoke *smoke)
 							  &smoke->prng)];
 }
 
+static int smoke_crescendo_thread(void *arg)
+{
+	struct preempt_smoke *smoke = arg;
+	IGT_TIMEOUT(end_time);
+	unsigned long count;
+
+	count = 0;
+	do {
+		struct i915_gem_context *ctx = smoke_context(smoke);
+		struct i915_request *rq;
+
+		mutex_lock(&smoke->i915->drm.struct_mutex);
+
+		ctx->sched.priority = count % I915_PRIORITY_MAX;
+
+		rq = i915_request_alloc(smoke->engine, ctx);
+		if (IS_ERR(rq)) {
+			mutex_unlock(&smoke->i915->drm.struct_mutex);
+			return PTR_ERR(rq);
+		}
+
+		i915_request_add(rq);
+
+		mutex_unlock(&smoke->i915->drm.struct_mutex);
+
+		count++;
+	} while (!__igt_timeout(end_time, NULL));
+
+	smoke->count = count;
+	return 0;
+}
+
 static int smoke_crescendo(struct preempt_smoke *smoke)
 {
+	struct task_struct *tsk[I915_NUM_ENGINES] = {};
+	struct preempt_smoke arg[I915_NUM_ENGINES];
 	struct intel_engine_cs *engine;
 	enum intel_engine_id id;
 	unsigned long count;
+	int err = 0;
+
+	mutex_unlock(&smoke->i915->drm.struct_mutex);
 
-	count = 0;
 	for_each_engine(engine, smoke->i915, id) {
-		IGT_TIMEOUT(end_time);
+		arg[id] = *smoke;
+		arg[id].engine = engine;
+		arg[id].count = 0;
+
+		tsk[id] = kthread_run(smoke_crescendo_thread, &arg,
+				      "igt/smoke:%d", id);
+		if (IS_ERR(tsk[id])) {
+			err = PTR_ERR(tsk[id]);
+			break;
+		}
+	}
 
-		do {
-			struct i915_gem_context *ctx = smoke_context(smoke);
-			struct i915_request *rq;
+	count = 0;
+	for_each_engine(engine, smoke->i915, id) {
+		int status;
 
-			ctx->sched.priority = count % I915_PRIORITY_MAX;
+		if (IS_ERR_OR_NULL(tsk[id]))
+			continue;
 
-			rq = i915_request_alloc(engine, ctx);
-			if (IS_ERR(rq))
-				return PTR_ERR(rq);
+		status = kthread_stop(tsk[id]);
+		if (status && !err)
+			err = status;
 
-			i915_request_add(rq);
-			count++;
-		} while (!__igt_timeout(end_time, NULL));
+		count += arg[id].count;
 	}
 
+	mutex_lock(&smoke->i915->drm.struct_mutex);
+
 	pr_info("Submitted %lu crescendo requests across %d engines and %d contexts\n",
 		count, INTEL_INFO(smoke->i915)->num_rings, smoke->ncontext);
 	return 0;
-- 
2.19.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 12+ messages in thread
* [PATCH 1/4] drm/i915/selftests: Split preemption smoke test into threads
@ 2018-09-28 13:58 Chris Wilson
  2018-10-01 10:38 ` Tvrtko Ursulin
  0 siblings, 1 reply; 12+ messages in thread
From: Chris Wilson @ 2018-09-28 13:58 UTC (permalink / raw)
  To: intel-gfx

When submitting chains to each engine, we can do so (mostly) in
parallel, so delegate submission to threads on a per-engine basis.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/selftests/intel_lrc.c | 73 ++++++++++++++++++----
 1 file changed, 61 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/i915/selftests/intel_lrc.c b/drivers/gpu/drm/i915/selftests/intel_lrc.c
index 3a474bb64c05..d68a924c530e 100644
--- a/drivers/gpu/drm/i915/selftests/intel_lrc.c
+++ b/drivers/gpu/drm/i915/selftests/intel_lrc.c
@@ -587,8 +587,10 @@ static int random_priority(struct rnd_state *rnd)
 struct preempt_smoke {
 	struct drm_i915_private *i915;
 	struct i915_gem_context **contexts;
+	struct intel_engine_cs *engine;
 	unsigned int ncontext;
 	struct rnd_state prng;
+	unsigned long count;
 };
 
 static struct i915_gem_context *smoke_context(struct preempt_smoke *smoke)
@@ -597,31 +599,78 @@ static struct i915_gem_context *smoke_context(struct preempt_smoke *smoke)
 							  &smoke->prng)];
 }
 
+static int smoke_crescendo_thread(void *arg)
+{
+	struct preempt_smoke *smoke = arg;
+	IGT_TIMEOUT(end_time);
+	unsigned long count;
+
+	count = 0;
+	do {
+		struct i915_gem_context *ctx = smoke_context(smoke);
+		struct i915_request *rq;
+
+		mutex_lock(&smoke->i915->drm.struct_mutex);
+
+		ctx->sched.priority = count % I915_PRIORITY_MAX;
+
+		rq = i915_request_alloc(smoke->engine, ctx);
+		if (IS_ERR(rq)) {
+			mutex_unlock(&smoke->i915->drm.struct_mutex);
+			return PTR_ERR(rq);
+		}
+
+		i915_request_add(rq);
+
+		mutex_unlock(&smoke->i915->drm.struct_mutex);
+
+		count++;
+	} while (!__igt_timeout(end_time, NULL));
+
+	smoke->count = count;
+	return 0;
+}
+
 static int smoke_crescendo(struct preempt_smoke *smoke)
 {
+	struct task_struct *tsk[I915_NUM_ENGINES] = {};
+	struct preempt_smoke arg[I915_NUM_ENGINES];
 	struct intel_engine_cs *engine;
 	enum intel_engine_id id;
 	unsigned long count;
+	int err = 0;
+
+	mutex_unlock(&smoke->i915->drm.struct_mutex);
 
-	count = 0;
 	for_each_engine(engine, smoke->i915, id) {
-		IGT_TIMEOUT(end_time);
+		arg[id] = *smoke;
+		arg[id].engine = engine;
+		arg[id].count = 0;
+
+		tsk[id] = kthread_run(smoke_crescendo_thread, &arg,
+				      "igt/smoke:%d", id);
+		if (IS_ERR(tsk[id])) {
+			err = PTR_ERR(tsk[id]);
+			break;
+		}
+	}
 
-		do {
-			struct i915_gem_context *ctx = smoke_context(smoke);
-			struct i915_request *rq;
+	count = 0;
+	for_each_engine(engine, smoke->i915, id) {
+		int status;
 
-			ctx->sched.priority = count % I915_PRIORITY_MAX;
+		if (IS_ERR_OR_NULL(tsk[id]))
+			continue;
 
-			rq = i915_request_alloc(engine, ctx);
-			if (IS_ERR(rq))
-				return PTR_ERR(rq);
+		status = kthread_stop(tsk[id]);
+		if (status && !err)
+			err = status;
 
-			i915_request_add(rq);
-			count++;
-		} while (!__igt_timeout(end_time, NULL));
+		count += arg[id].count;
 	}
 
+	mutex_lock(&smoke->i915->drm.struct_mutex);
+
 	pr_info("Submitted %lu crescendo requests across %d engines and %d contexts\n",
 		count, INTEL_INFO(smoke->i915)->num_rings, smoke->ncontext);
 	return 0;
-- 
2.19.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-10-01 14:41 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-01 12:32 [PATCH 1/4] drm/i915/selftests: Split preemption smoke test into threads Chris Wilson
2018-10-01 12:32 ` [PATCH 2/4] drm/i915/selftests: Include arbitration points in preemption smoketest Chris Wilson
2018-10-01 14:01   ` Tvrtko Ursulin
2018-10-01 12:32 ` [PATCH 3/4] drm/i915: Reserve some priority bits for internal use Chris Wilson
2018-10-01 12:32 ` [PATCH 4/4] drm/i915: Combine multiple internal plists into the same i915_priolist bucket Chris Wilson
2018-10-01 12:45 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/4] drm/i915/selftests: Split preemption smoke test into threads Patchwork
2018-10-01 13:08 ` ✓ Fi.CI.BAT: success " Patchwork
2018-10-01 13:16 ` [PATCH 1/4] " Tvrtko Ursulin
2018-10-01 14:41 ` ✓ Fi.CI.IGT: success for series starting with [1/4] " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2018-09-28 13:58 [PATCH 1/4] " Chris Wilson
2018-10-01 10:38 ` Tvrtko Ursulin
2018-10-01 10:53   ` Chris Wilson

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.