]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/selftests: Start kthreads before stopping
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 1 Nov 2019 08:49:40 +0000 (08:49 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 1 Nov 2019 10:12:29 +0000 (10:12 +0000)
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>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191101084940.31838-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
drivers/gpu/drm/i915/gem/selftests/i915_gem_object_blt.c
drivers/gpu/drm/i915/gt/selftest_hangcheck.c
drivers/gpu/drm/i915/gt/selftest_lrc.c
drivers/gpu/drm/i915/selftests/i915_request.c

index c6e61564bb5e93b6fc697bc3d7d74a1664c73580..62fabc023a83e41720fb8b205ec5d7376fb106d9 100644 (file)
@@ -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;
 
index ac40c704514e10c1e6c9e62b476b95ca5aca5dcb..e8132aca0bb630a57b2f5d0f365f2175184d4729 100644 (file)
@@ -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;
 
index 8abc0a1d692b00eef36eb4207e089305683c352c..85e9ccf5c30413c27be043284f10be1ad9363e43 100644 (file)
@@ -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 {
index 5e8c365548f0be9a35d6c73467ba6eb5d1dcc041..eb71ac2f992c42ec36627488964b661bef587975 100644 (file)
@@ -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;
index 30ae34f621761f54cbffda0a0321990978c7a555..8618a4dc07012223312ea9709cc459dc17e95e23 100644 (file)
@@ -464,6 +464,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++) {
@@ -1158,6 +1159,8 @@ static int live_parallel_engines(void *arg)
                        get_task_struct(tsk[idx++]);
                }
 
+               yield(); /* start all threads before we kthread_stop() */
+
                idx = 0;
                for_each_uabi_engine(engine, i915) {
                        int status;
@@ -1314,6 +1317,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: