All of lore.kernel.org
 help / color / mirror / Atom feed
From: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
To: Petri Latvala <petri.latvala@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: [RFC PATCH] drm/i915/debugfs: Only wedge if we have reset available
Date: Wed,  2 Oct 2019 14:48:20 +0200	[thread overview]
Message-ID: <20191002124820.1862-1-janusz.krzysztofik@linux.intel.com> (raw)

If we process DROP_RESET_ACTIVE and cancel all outstanding requests by
forcing a GPU reset on a hardware with reset capabilities disabled or
not supported, we certainly end up with a terminally wedged GPU,
impossible to recover.  That's probably not what we want.

Before setting the GPU wedged, verify if we have GPU reset available
and fail with -EBUSY if not.

Suggested-by: Petri Latvala <petri.latvala@intel.com>
Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
Cc: Michał Wajdeczko <michal.wajdeczko@intel.com>
Cc: Michał Winiarski <michal.winiarski@intel.com>
Cc: Piotr Piórkowski <piotr.piorkowski@intel.com>
Cc: Tomasz Lis <tomasz.lis@intel.com>
Cc: Petri Latvala <petri.latvala@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Martin Peres <martin.peres@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index fec9fb7cc384..0774ca6e2a05 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -3627,8 +3627,17 @@ i915_drop_caches_set(void *data, u64 val)
 
 	if (val & DROP_RESET_ACTIVE &&
 	    wait_for(intel_engines_are_idle(&i915->gt),
-		     I915_IDLE_ENGINES_TIMEOUT))
+		     I915_IDLE_ENGINES_TIMEOUT)) {
+		/*
+		 * Only wedge if reset is supported and not disabled, otherwise
+		 * we certainly end up with the GPU terminally wedged.  Inform
+		 * userspace about the problem instead.
+		 */
+		if (!intel_has_gpu_reset(&i915->gt))
+			return -EBUSY;
+
 		intel_gt_set_wedged(&i915->gt);
+	}
 
 	/* No need to check and wait for gpu resets, only libdrm auto-restarts
 	 * on ioctls on -EAGAIN. */
-- 
2.21.0

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

             reply	other threads:[~2019-10-02 12:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-02 12:48 Janusz Krzysztofik [this message]
2019-10-02 15:45 ` [RFC PATCH] drm/i915/debugfs: Only wedge if we have reset available Tvrtko Ursulin
2019-10-02 15:59   ` Chris Wilson
2019-10-02 16:33 ` [Intel-gfx] " kbuild test robot
2019-10-02 17:00 ` ✓ Fi.CI.BAT: success for " Patchwork
2019-10-02 17:31 ` [Intel-gfx] [RFC PATCH] " kbuild test robot
2019-10-03  1:07 ` ✓ Fi.CI.IGT: success for " 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=20191002124820.1862-1-janusz.krzysztofik@linux.intel.com \
    --to=janusz.krzysztofik@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=petri.latvala@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.