All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: jani.nikula@intel.com,
	Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
	luciano.coelho@intel.com
Subject: [Intel-gfx] [PATCH v6 3/3] drm/i915/selftests: add local workqueue for SW fence selftest
Date: Thu,  8 Jun 2023 16:35:46 +0300	[thread overview]
Message-ID: <313f4a713053c2b4896ced5b0e9ff456eb85fe57.1686231190.git.jani.nikula@intel.com> (raw)
In-Reply-To: <cover.1686231190.git.jani.nikula@intel.com>

From: Luca Coelho <luciano.coelho@intel.com>

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>
---
 drivers/gpu/drm/i915/selftests/i915_sw_fence.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/selftests/i915_sw_fence.c b/drivers/gpu/drm/i915/selftests/i915_sw_fence.c
index daa985e5a19b..8f5ce71fa453 100644
--- a/drivers/gpu/drm/i915/selftests/i915_sw_fence.c
+++ b/drivers/gpu/drm/i915/selftests/i915_sw_fence.c
@@ -523,12 +523,19 @@ static void task_ipc(struct work_struct *work)
 static int test_ipc(void *arg)
 {
 	struct task_ipc ipc;
+	struct workqueue_struct *wq;
 	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 */
 	ipc.in = alloc_fence();
-	if (!ipc.in)
-		return -ENOMEM;
+	if (!ipc.in) {
+		ret = -ENOMEM;
+		goto err_work;
+	}
 	ipc.out = alloc_fence();
 	if (!ipc.out) {
 		ret = -ENOMEM;
@@ -540,7 +547,7 @@ static int test_ipc(void *arg)
 
 	ipc.value = 0;
 	INIT_WORK_ONSTACK(&ipc.work, task_ipc);
-	schedule_work(&ipc.work);
+	queue_work(wq, &ipc.work);
 
 	wait_for_completion(&ipc.started);
 
@@ -563,6 +570,9 @@ static int test_ipc(void *arg)
 	free_fence(ipc.out);
 err_in:
 	free_fence(ipc.in);
+err_work:
+	destroy_workqueue(wq);
+
 	return ret;
 }
 
-- 
2.39.2


  parent reply	other threads:[~2023-06-08 13:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-08 13:35 [Intel-gfx] [PATCH v6 0/3] drm/i915: implement internal workqueues Jani Nikula
2023-06-08 13:35 ` [Intel-gfx] [PATCH v6 1/3] drm/i915: use pointer to i915 instead of rpm in wakeref Jani Nikula
2023-06-08 13:35 ` [Intel-gfx] [PATCH v6 2/3] drm/i915: add a dedicated workqueue inside drm_i915_private Jani Nikula
2023-06-08 14:17   ` Tvrtko Ursulin
2023-06-08 14:17   ` Tetsuo Handa
2023-06-08 13:35 ` Jani Nikula [this message]
2023-06-08 13:54   ` [Intel-gfx] [PATCH v6 3/3] drm/i915/selftests: add local workqueue for SW fence selftest Tetsuo Handa
2023-06-08 17:58 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: implement internal workqueues (rev4) Patchwork
2023-06-08 17:58 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2023-06-08 18:24 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-06-09 23:59 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2023-06-10  6:58 ` [Intel-gfx] [PATCH v6 0/3] drm/i915: implement internal workqueues Jani Nikula

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=313f4a713053c2b4896ced5b0e9ff456eb85fe57.1686231190.git.jani.nikula@intel.com \
    --to=jani.nikula@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=luciano.coelho@intel.com \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.