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
                        get_task_struct(data[n].tsk);
                }
 
+               yield(); /* start all threads before we kthread_stop() */
+
                for (n = 0; n < count; n++) {
                        int status;
 
 
                get_task_struct(tsk[i]);
        }
 
+       yield(); /* start all threads before we kthread_stop() */
+
        for (i = 0; i < n_cpus; ++i) {
                int status;
 
 
                        get_task_struct(tsk);
                }
 
+               yield(); /* start all threads before we begin */
+
                intel_engine_pm_get(engine);
                set_bit(I915_RESET_ENGINE + id, >->reset.flags);
                do {
 
                get_task_struct(tsk[id]);
        }
 
+       yield(); /* start all threads before we kthread_stop() */
+
        count = 0;
        for_each_engine(engine, smoke->gt, id) {
                int status;
 
                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++) {
                        get_task_struct(tsk[idx++]);
                }
 
+               yield(); /* start all threads before we kthread_stop() */
+
                idx = 0;
                for_each_uabi_engine(engine, i915) {
                        int status;
                idx++;
        }
 
+       yield(); /* start all threads before we begin */
        msleep(jiffies_to_msecs(i915_selftest.timeout_jiffies));
 
 out_flush: