Commit 0976b3dc authored by Luca Coelho's avatar Luca Coelho Committed by Jani Nikula

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: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/313f4a713053c2b4896ced5b0e9ff456eb85fe57.1686231190.git.jani.nikula@intel.com
parent 848a4e5c
...@@ -523,12 +523,19 @@ static void task_ipc(struct work_struct *work) ...@@ -523,12 +523,19 @@ static void task_ipc(struct work_struct *work)
static int test_ipc(void *arg) static int test_ipc(void *arg)
{ {
struct task_ipc ipc; struct task_ipc ipc;
struct workqueue_struct *wq;
int ret = 0; int ret = 0;
wq = alloc_workqueue("i1915-selftest", 0, 0);
if (wq == NULL)
return -ENOMEM;
/* Test use of i915_sw_fence as an interprocess signaling mechanism */ /* Test use of i915_sw_fence as an interprocess signaling mechanism */
ipc.in = alloc_fence(); ipc.in = alloc_fence();
if (!ipc.in) if (!ipc.in) {
return -ENOMEM; ret = -ENOMEM;
goto err_work;
}
ipc.out = alloc_fence(); ipc.out = alloc_fence();
if (!ipc.out) { if (!ipc.out) {
ret = -ENOMEM; ret = -ENOMEM;
...@@ -540,7 +547,7 @@ static int test_ipc(void *arg) ...@@ -540,7 +547,7 @@ static int test_ipc(void *arg)
ipc.value = 0; ipc.value = 0;
INIT_WORK_ONSTACK(&ipc.work, task_ipc); INIT_WORK_ONSTACK(&ipc.work, task_ipc);
schedule_work(&ipc.work); queue_work(wq, &ipc.work);
wait_for_completion(&ipc.started); wait_for_completion(&ipc.started);
...@@ -563,6 +570,9 @@ static int test_ipc(void *arg) ...@@ -563,6 +570,9 @@ static int test_ipc(void *arg)
free_fence(ipc.out); free_fence(ipc.out);
err_in: err_in:
free_fence(ipc.in); free_fence(ipc.in);
err_work:
destroy_workqueue(wq);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment