All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ramalingam C <ramalingam.c@intel.com>
To: intel-gfx <intel-gfx@lists.freedesktop.org>,
	dri-devel <dri-devel@lists.freedesktop.org>
Cc: CQ Tang <cq.tang@intel.com>,
	Hellstrom Thomas <thomas.hellstrom@intel.com>,
	Chris Wilson <chris@chris-wilson.co.uk>
Subject: [PATCH 4/4] drm/i915/selftest: Always cancel semaphore on error
Date: Mon, 14 Mar 2022 23:50:05 +0530	[thread overview]
Message-ID: <20220314182005.17071-5-ramalingam.c@intel.com> (raw)
In-Reply-To: <20220314182005.17071-1-ramalingam.c@intel.com>

From: Chris Wilson <chris@chris-wilson.co.uk>

Ensure that we always signal the semaphore when timing out, so that if it
happens to be stuck waiting for the semaphore we will quickly recover
without having to wait for a reset.

Reported-by: CQ Tang <cq.tang@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: CQ Tang <cq.tang@intel.com>
cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/gpu/drm/i915/gt/selftest_lrc.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/selftest_lrc.c b/drivers/gpu/drm/i915/gt/selftest_lrc.c
index b9cc89de01bf..ae16668dd9d4 100644
--- a/drivers/gpu/drm/i915/gt/selftest_lrc.c
+++ b/drivers/gpu/drm/i915/gt/selftest_lrc.c
@@ -1435,18 +1435,17 @@ static int __lrc_isolation(struct intel_engine_cs *engine, u32 poison)
 	}
 
 	err = poison_registers(B, poison, sema);
-	if (err) {
-		WRITE_ONCE(*sema, -1);
-		i915_request_put(rq);
-		goto err_result1;
-	}
-
-	if (i915_request_wait(rq, 0, HZ / 2) < 0) {
-		i915_request_put(rq);
+	if (err == 0 && i915_request_wait(rq, 0, HZ / 2) < 0) {
+		pr_err("%s(%s): wait for results timed out\n",
+		       __func__, engine->name);
 		err = -ETIME;
-		goto err_result1;
 	}
+
+	/* Always cancel the semaphore wait, just in case the GPU gets stuck */
+	WRITE_ONCE(*sema, -1);
 	i915_request_put(rq);
+	if (err)
+		goto err_result1;
 
 	err = compare_isolation(engine, ref, result, A, poison);
 
-- 
2.20.1


WARNING: multiple messages have this Message-ID (diff)
From: Ramalingam C <ramalingam.c@intel.com>
To: intel-gfx <intel-gfx@lists.freedesktop.org>,
	dri-devel <dri-devel@lists.freedesktop.org>
Cc: CQ Tang <cq.tang@intel.com>,
	Hellstrom Thomas <thomas.hellstrom@intel.com>,
	Chris Wilson <chris@chris-wilson.co.uk>
Subject: [Intel-gfx] [PATCH 4/4] drm/i915/selftest: Always cancel semaphore on error
Date: Mon, 14 Mar 2022 23:50:05 +0530	[thread overview]
Message-ID: <20220314182005.17071-5-ramalingam.c@intel.com> (raw)
In-Reply-To: <20220314182005.17071-1-ramalingam.c@intel.com>

From: Chris Wilson <chris@chris-wilson.co.uk>

Ensure that we always signal the semaphore when timing out, so that if it
happens to be stuck waiting for the semaphore we will quickly recover
without having to wait for a reset.

Reported-by: CQ Tang <cq.tang@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: CQ Tang <cq.tang@intel.com>
cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/gpu/drm/i915/gt/selftest_lrc.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/selftest_lrc.c b/drivers/gpu/drm/i915/gt/selftest_lrc.c
index b9cc89de01bf..ae16668dd9d4 100644
--- a/drivers/gpu/drm/i915/gt/selftest_lrc.c
+++ b/drivers/gpu/drm/i915/gt/selftest_lrc.c
@@ -1435,18 +1435,17 @@ static int __lrc_isolation(struct intel_engine_cs *engine, u32 poison)
 	}
 
 	err = poison_registers(B, poison, sema);
-	if (err) {
-		WRITE_ONCE(*sema, -1);
-		i915_request_put(rq);
-		goto err_result1;
-	}
-
-	if (i915_request_wait(rq, 0, HZ / 2) < 0) {
-		i915_request_put(rq);
+	if (err == 0 && i915_request_wait(rq, 0, HZ / 2) < 0) {
+		pr_err("%s(%s): wait for results timed out\n",
+		       __func__, engine->name);
 		err = -ETIME;
-		goto err_result1;
 	}
+
+	/* Always cancel the semaphore wait, just in case the GPU gets stuck */
+	WRITE_ONCE(*sema, -1);
 	i915_request_put(rq);
+	if (err)
+		goto err_result1;
 
 	err = compare_isolation(engine, ref, result, A, poison);
 
-- 
2.20.1


  parent reply	other threads:[~2022-03-14 18:19 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-14 18:20 [PATCH 0/4] lrc selftest fixes Ramalingam C
2022-03-14 18:20 ` [Intel-gfx] " Ramalingam C
2022-03-14 18:20 ` [PATCH 1/4] drm/i915/gt: Explicitly clear BB_OFFSET for new contexts Ramalingam C
2022-03-14 18:20   ` [Intel-gfx] " Ramalingam C
2022-04-08 14:45   ` Thomas Hellström
2022-03-14 18:20 ` [PATCH 2/4] drm/i915/selftests: Check for incomplete LRI from the context image Ramalingam C
2022-03-14 18:20   ` [Intel-gfx] " Ramalingam C
2022-04-08 14:38   ` Thomas Hellström (Intel)
2022-03-14 18:20 ` [PATCH 3/4] drm/i915/selftest: Clear the output buffers before GPU writes Ramalingam C
2022-03-14 18:20   ` [Intel-gfx] " Ramalingam C
2022-03-21 23:26   ` [PATCH v2 " Ramalingam C
2022-03-21 23:26     ` [Intel-gfx] " Ramalingam C
2022-04-08 14:40   ` [Intel-gfx] [PATCH " Thomas Hellström
2022-03-14 18:20 ` Ramalingam C [this message]
2022-03-14 18:20   ` [Intel-gfx] [PATCH 4/4] drm/i915/selftest: Always cancel semaphore on error Ramalingam C
2022-04-08 14:43   ` Thomas Hellström
2022-03-14 20:46 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for lrc selftest fixes (rev2) Patchwork
2022-03-14 20:47 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-03-14 21:18 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2022-03-22  2:18 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for lrc selftest fixes (rev3) Patchwork
2022-03-22  2:19 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-03-22  2:23 ` [Intel-gfx] ✗ Fi.CI.DOCS: " Patchwork
2022-03-22  2:50 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork

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=20220314182005.17071-5-ramalingam.c@intel.com \
    --to=ramalingam.c@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=cq.tang@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=thomas.hellstrom@intel.com \
    /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.