Skip to content

Commit 0976b3d

Browse files
lucacoelhojnikula
authored andcommitted
drm/i915/selftests: add local workqueue for SW fence selftest
Instead of using a global workqueue for the SW fence selftest, allocate a separate one temporarily only while running the test. Cc: Tetsuo Handa <[email protected]> Cc: Jani Nikula <[email protected]> Cc: Ville Syrjälä <[email protected]> Reviewed-by: Tvrtko Ursulin <[email protected]> Signed-off-by: Luca Coelho <[email protected]> Signed-off-by: Jani Nikula <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/313f4a713053c2b4896ced5b0e9ff456eb85fe57.1686231190.git.jani.nikula@intel.com
1 parent 848a4e5 commit 0976b3d

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -523,12 +523,19 @@ static void task_ipc(struct work_struct *work)
523523
static int test_ipc(void *arg)
524524
{
525525
struct task_ipc ipc;
526+
struct workqueue_struct *wq;
526527
int ret = 0;
527528

529+
wq = alloc_workqueue("i1915-selftest", 0, 0);
530+
if (wq == NULL)
531+
return -ENOMEM;
532+
528533
/* Test use of i915_sw_fence as an interprocess signaling mechanism */
529534
ipc.in = alloc_fence();
530-
if (!ipc.in)
531-
return -ENOMEM;
535+
if (!ipc.in) {
536+
ret = -ENOMEM;
537+
goto err_work;
538+
}
532539
ipc.out = alloc_fence();
533540
if (!ipc.out) {
534541
ret = -ENOMEM;
@@ -540,7 +547,7 @@ static int test_ipc(void *arg)
540547

541548
ipc.value = 0;
542549
INIT_WORK_ONSTACK(&ipc.work, task_ipc);
543-
schedule_work(&ipc.work);
550+
queue_work(wq, &ipc.work);
544551

545552
wait_for_completion(&ipc.started);
546553

@@ -563,6 +570,9 @@ static int test_ipc(void *arg)
563570
free_fence(ipc.out);
564571
err_in:
565572
free_fence(ipc.in);
573+
err_work:
574+
destroy_workqueue(wq);
575+
566576
return ret;
567577
}
568578

0 commit comments

Comments
 (0)