Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/313f4a713053c2b4896ced5b0e9ff456eb85fe57.1686231190.git.jani.nikula@intel.com

authored by

Luca Coelho and committed by
Jani Nikula
0976b3dc 848a4e5c

+13 -3
+13 -3
drivers/gpu/drm/i915/selftests/i915_sw_fence.c
··· 523 523 static int test_ipc(void *arg) 524 524 { 525 525 struct task_ipc ipc; 526 + struct workqueue_struct *wq; 526 527 int ret = 0; 528 + 529 + wq = alloc_workqueue("i1915-selftest", 0, 0); 530 + if (wq == NULL) 531 + return -ENOMEM; 527 532 528 533 /* Test use of i915_sw_fence as an interprocess signaling mechanism */ 529 534 ipc.in = alloc_fence(); 530 - if (!ipc.in) 531 - return -ENOMEM; 535 + if (!ipc.in) { 536 + ret = -ENOMEM; 537 + goto err_work; 538 + } 532 539 ipc.out = alloc_fence(); 533 540 if (!ipc.out) { 534 541 ret = -ENOMEM; ··· 547 540 548 541 ipc.value = 0; 549 542 INIT_WORK_ONSTACK(&ipc.work, task_ipc); 550 - schedule_work(&ipc.work); 543 + queue_work(wq, &ipc.work); 551 544 552 545 wait_for_completion(&ipc.started); 553 546 ··· 570 563 free_fence(ipc.out); 571 564 err_in: 572 565 free_fence(ipc.in); 566 + err_work: 567 + destroy_workqueue(wq); 568 + 573 569 return ret; 574 570 } 575 571