Skip to content

Commit e5661c6

Browse files
committed
drm/i915/selftests: Start kthreads before stopping
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 <[email protected]> Cc: Matthew Auld <[email protected]> Reviewed-by: Matthew Auld <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 292a27b commit e5661c6

File tree

5 files changed

+12
-0
lines changed

5 files changed

+12
-0
lines changed

drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,8 @@ static int live_parallel_switch(void *arg)
345345
get_task_struct(data[n].tsk);
346346
}
347347

348+
yield(); /* start all threads before we kthread_stop() */
349+
348350
for (n = 0; n < count; n++) {
349351
int status;
350352

drivers/gpu/drm/i915/gem/selftests/i915_gem_object_blt.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,8 @@ static int igt_threaded_blt(struct drm_i915_private *i915,
473473
get_task_struct(tsk[i]);
474474
}
475475

476+
yield(); /* start all threads before we kthread_stop() */
477+
476478
for (i = 0; i < n_cpus; ++i) {
477479
int status;
478480

drivers/gpu/drm/i915/gt/selftest_hangcheck.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,6 +826,8 @@ static int __igt_reset_engines(struct intel_gt *gt,
826826
get_task_struct(tsk);
827827
}
828828

829+
yield(); /* start all threads before we begin */
830+
829831
intel_engine_pm_get(engine);
830832
set_bit(I915_RESET_ENGINE + id, &gt->reset.flags);
831833
do {

drivers/gpu/drm/i915/gt/selftest_lrc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2252,6 +2252,8 @@ static int smoke_crescendo(struct preempt_smoke *smoke, unsigned int flags)
22522252
get_task_struct(tsk[id]);
22532253
}
22542254

2255+
yield(); /* start all threads before we kthread_stop() */
2256+
22552257
count = 0;
22562258
for_each_engine(engine, smoke->gt, id) {
22572259
int status;

drivers/gpu/drm/i915/selftests/i915_request.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,7 @@ static int mock_breadcrumbs_smoketest(void *arg)
464464
get_task_struct(threads[n]);
465465
}
466466

467+
yield(); /* start all threads before we begin */
467468
msleep(jiffies_to_msecs(i915_selftest.timeout_jiffies));
468469

469470
for (n = 0; n < ncpus; n++) {
@@ -1158,6 +1159,8 @@ static int live_parallel_engines(void *arg)
11581159
get_task_struct(tsk[idx++]);
11591160
}
11601161

1162+
yield(); /* start all threads before we kthread_stop() */
1163+
11611164
idx = 0;
11621165
for_each_uabi_engine(engine, i915) {
11631166
int status;
@@ -1314,6 +1317,7 @@ static int live_breadcrumbs_smoketest(void *arg)
13141317
idx++;
13151318
}
13161319

1320+
yield(); /* start all threads before we begin */
13171321
msleep(jiffies_to_msecs(i915_selftest.timeout_jiffies));
13181322

13191323
out_flush:

0 commit comments

Comments
 (0)