All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Subject: [Intel-gfx] [PATCH] drm/i915/selftests: Allow the module to load even if live selftests fail
Date: Mon,  8 Feb 2021 12:15:23 +0000	[thread overview]
Message-ID: <20210208121523.21716-1-chris@chris-wilson.co.uk> (raw)

i915.live_selftests takes 3 options:
  0: do nothing
 -1: run selftests and prevent continuation of device probing
  1: run selftests, and allow continuation of device probing

Currently, we prevent the device from being loaded if the live selftests
fail. This seems reasonable, since the selftests indicate something is
amiss with the driver. But it does prevent the driver being used
even with a minor fault, and so prevent further inspection of the driver
state afterwards.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/selftests/i915_selftest.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/selftests/i915_selftest.c b/drivers/gpu/drm/i915/selftests/i915_selftest.c
index 1bc11c09faef..6d1fa2b25cbf 100644
--- a/drivers/gpu/drm/i915/selftests/i915_selftest.c
+++ b/drivers/gpu/drm/i915/selftests/i915_selftest.c
@@ -200,23 +200,23 @@ int i915_mock_selftests(void)
 
 int i915_live_selftests(struct pci_dev *pdev)
 {
-	int err;
+	int err = 0;
 
 	if (!i915_selftest.live)
 		return 0;
 
 	err = run_selftests(live, pdev_to_i915(pdev));
-	if (err) {
-		i915_selftest.live = err;
-		return err;
-	}
-
 	if (i915_selftest.live < 0) {
-		i915_selftest.live = -ENOTTY;
-		return 1;
+		/* Abort module probe in case we destablised the system */
+		if (err == 0) {
+			i915_selftest.live = -ENOTTY;
+			err = 1;
+		} else {
+			i915_selftest.live = err;
+		}
 	}
 
-	return 0;
+	return err;
 }
 
 int i915_perf_selftests(struct pci_dev *pdev)
-- 
2.20.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

             reply	other threads:[~2021-02-08 12:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-08 12:15 Chris Wilson [this message]
2021-02-08 18:26 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/selftests: Allow the module to load even if live selftests fail Patchwork
2021-02-08 22:34 ` [Intel-gfx] ✓ Fi.CI.IGT: " 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=20210208121523.21716-1-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /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.