Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915/selftests: Start kthreads before stopping
@ 2019-11-01  8:49 Chris Wilson
  2019-11-01  8:49 ` [Intel-gfx] " Chris Wilson
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Chris Wilson @ 2019-11-01  8:49 UTC (permalink / raw)
  To: intel-gfx; +Cc: Matthew Auld

An interesting observation made with our parallel selftests was that on
our small/single cpu systems we would call kthread_stop() before the
kthreads were spawned. If this happens, the kthread is never run at all;
completely bypassing the test.

A simple yield() from the parent will ensure that all children have the
opportunity to start before we reap them.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.auld@intel.com>
---
 drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c    | 2 ++
 drivers/gpu/drm/i915/gem/selftests/i915_gem_object_blt.c | 2 ++
 drivers/gpu/drm/i915/gt/selftest_hangcheck.c             | 2 ++
 drivers/gpu/drm/i915/gt/selftest_lrc.c                   | 2 ++
 drivers/gpu/drm/i915/selftests/i915_request.c            | 2 ++
 5 files changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c b/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
index c6e61564bb5e..62fabc023a83 100644
--- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
@@ -345,6 +345,8 @@ static int live_parallel_switch(void *arg)
 			get_task_struct(data[n].tsk);
 		}
 
+		yield(); /* start all threads before we kthread_stop() */
+
 		for (n = 0; n < count; n++) {
 			int status;
 
diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_object_blt.c b/drivers/gpu/drm/i915/gem/selftests/i915_gem_object_blt.c
index ac40c704514e..e8132aca0bb6 100644
--- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_object_blt.c
+++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_object_blt.c
@@ -473,6 +473,8 @@ static int igt_threaded_blt(struct drm_i915_private *i915,
 		get_task_struct(tsk[i]);
 	}
 
+	yield(); /* start all threads before we kthread_stop() */
+
 	for (i = 0; i < n_cpus; ++i) {
 		int status;
 
diff --git a/drivers/gpu/drm/i915/gt/selftest_hangcheck.c b/drivers/gpu/drm/i915/gt/selftest_hangcheck.c
index 8abc0a1d692b..85e9ccf5c304 100644
--- a/drivers/gpu/drm/i915/gt/selftest_hangcheck.c
+++ b/drivers/gpu/drm/i915/gt/selftest_hangcheck.c
@@ -826,6 +826,8 @@ static int __igt_reset_engines(struct intel_gt *gt,
 			get_task_struct(tsk);
 		}
 
+		yield(); /* start all threads before we begin */
+
 		intel_engine_pm_get(engine);
 		set_bit(I915_RESET_ENGINE + id, &gt->reset.flags);
 		do {
diff --git a/drivers/gpu/drm/i915/gt/selftest_lrc.c b/drivers/gpu/drm/i915/gt/selftest_lrc.c
index 5e8c365548f0..eb71ac2f992c 100644
--- a/drivers/gpu/drm/i915/gt/selftest_lrc.c
+++ b/drivers/gpu/drm/i915/gt/selftest_lrc.c
@@ -2252,6 +2252,8 @@ static int smoke_crescendo(struct preempt_smoke *smoke, unsigned int flags)
 		get_task_struct(tsk[id]);
 	}
 
+	yield(); /* start all threads before we kthread_stop() */
+
 	count = 0;
 	for_each_engine(engine, smoke->gt, id) {
 		int status;
diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c
index 74788980ca7a..ef350ff3c35c 100644
--- a/drivers/gpu/drm/i915/selftests/i915_request.c
+++ b/drivers/gpu/drm/i915/selftests/i915_request.c
@@ -465,6 +465,7 @@ static int mock_breadcrumbs_smoketest(void *arg)
 		get_task_struct(threads[n]);
 	}
 
+	yield(); /* start all threads before we begin */
 	msleep(jiffies_to_msecs(i915_selftest.timeout_jiffies));
 
 	for (n = 0; n < ncpus; n++) {
@@ -1392,6 +1393,7 @@ static int live_breadcrumbs_smoketest(void *arg)
 		idx++;
 	}
 
+	yield(); /* start all threads before we begin */
 	msleep(jiffies_to_msecs(i915_selftest.timeout_jiffies));
 
 out_flush:
-- 
2.24.0.rc2

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

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

end of thread, other threads:[~2019-11-02 14:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-01  8:49 [PATCH] drm/i915/selftests: Start kthreads before stopping Chris Wilson
2019-11-01  8:49 ` [Intel-gfx] " Chris Wilson
2019-11-01  9:37 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2019-11-01  9:37   ` [Intel-gfx] " Patchwork
2019-11-01  9:54 ` [PATCH] " Matthew Auld
2019-11-01  9:54   ` [Intel-gfx] " Matthew Auld
2019-11-01 10:08 ` ✓ Fi.CI.BAT: success for " Patchwork
2019-11-01 10:08   ` [Intel-gfx] " Patchwork
2019-11-02 14:59 ` ✓ Fi.CI.IGT: " Patchwork
2019-11-02 14:59   ` [Intel-gfx] " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox