From: Tomas Elf <tomas.elf@intel.com>
To: Intel-GFX@Lists.FreeDesktop.Org
Subject: [PATCH 1/8] drm/i915: Early exit from semaphore_waits_for for execlist mode.
Date: Thu, 8 Oct 2015 19:31:33 +0100 [thread overview]
Message-ID: <1444329100-19189-2-git-send-email-tomas.elf@intel.com> (raw)
In-Reply-To: <1444329100-19189-1-git-send-email-tomas.elf@intel.com>
When submitting semaphores in execlist mode the hang checker crashes in this
function because it is only runnable in ring submission mode. The reason this
is of particular interest to the TDR patch series is because we use semaphores
as a mean to induce hangs during testing (which is the recommended way to
induce hangs for gen8+). It's not clear how this is supposed to work in
execlist mode since:
1. This function requires a ring buffer.
2. Retrieving a ring buffer in execlist mode requires us to retrieve the
corresponding context, which we get from a request.
3. Retieving a request from the hang checker is not straight-forward since that
requires us to grab the struct_mutex in order to synchronize against the
request retirement thread.
4. Grabbing the struct_mutex from the hang checker is nothing that we will do
since that puts us at risk of deadlock since a hung thread might be holding the
struct_mutex already.
Therefore it's not obvious how we're supposed to deal with this. For now, we're
doing an early exit from this function, which avoids any kernel panic situation
when running our own internal TDR ULT.
* v2: (Chris Wilson)
Turned the execlist mode check into a ringbuffer NULL check to make it more
submission mode agnostic and less of a layering violation.
Signed-off-by: Tomas Elf <tomas.elf@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
---
drivers/gpu/drm/i915/i915_irq.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 8ca772d..132e8f3 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -2782,6 +2782,26 @@ semaphore_waits_for(struct intel_engine_cs *ring, u32 *seqno)
u64 offset = 0;
int i, backwards;
+ /*
+ * This function does not support execlist mode - any attempt to
+ * proceed further into this function will result in a kernel panic
+ * when dereferencing ring->buffer, which is not set up in execlist
+ * mode.
+ *
+ * The correct way of doing it would be to derive the currently
+ * executing ring buffer from the current context, which is derived
+ * from the currently running request. Unfortunately, to get the
+ * current request we would have to grab the struct_mutex before doing
+ * anything else, which would be ill-advised since some other thread
+ * might have grabbed it already and managed to hang itself, causing
+ * the hang checker to deadlock.
+ *
+ * Therefore, this function does not support execlist mode in its
+ * current form. Just return NULL and move on.
+ */
+ if (ring->buffer == NULL)
+ return NULL;
+
ipehr = I915_READ(RING_IPEHR(ring->mmio_base));
if (!ipehr_is_semaphore_wait(ring->dev, ipehr))
return NULL;
--
1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-10-08 18:31 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-08 18:31 [PATCH 0/8] Stability improvements to error state capture Tomas Elf
2015-10-08 18:31 ` Tomas Elf [this message]
2015-10-08 18:31 ` [PATCH 2/8] drm/i915: Migrate to safe iterators in " Tomas Elf
2015-10-09 7:49 ` Chris Wilson
2015-10-09 11:38 ` Tomas Elf
2015-10-09 8:27 ` Daniel Vetter
2015-10-09 11:40 ` Tomas Elf
2015-10-13 11:37 ` Daniel Vetter
2015-10-13 11:47 ` Chris Wilson
2015-10-08 18:31 ` [PATCH 3/8] drm/i915: Cope with request list state change during " Tomas Elf
2015-10-09 7:48 ` Chris Wilson
2015-10-09 11:25 ` Tomas Elf
2015-10-13 11:39 ` Daniel Vetter
2015-10-14 11:46 ` Tomas Elf
2015-10-14 12:45 ` Daniel Vetter
2015-10-09 8:28 ` Daniel Vetter
2015-10-09 11:45 ` Tomas Elf
2015-10-13 11:40 ` Daniel Vetter
2015-10-08 18:31 ` [PATCH 4/8] drm/i915: NULL checking when capturing buffer objects " Tomas Elf
2015-10-09 7:49 ` Chris Wilson
2015-10-09 11:34 ` Tomas Elf
2015-10-09 8:32 ` Daniel Vetter
2015-10-09 8:47 ` Chris Wilson
2015-10-09 11:52 ` Tomas Elf
2015-10-09 11:45 ` Tomas Elf
2015-10-08 18:31 ` [PATCH 5/8] drm/i915: vma NULL pointer check Tomas Elf
2015-10-09 7:48 ` Chris Wilson
2015-10-09 11:30 ` Tomas Elf
2015-10-09 11:59 ` Chris Wilson
2015-10-13 11:43 ` Daniel Vetter
2015-10-09 8:33 ` Daniel Vetter
2015-10-09 11:46 ` Tomas Elf
2015-10-08 18:31 ` [PATCH 6/8] drm/i915: Use safe list iterators Tomas Elf
2015-10-09 7:41 ` Chris Wilson
2015-10-09 10:27 ` Tomas Elf
2015-10-09 10:38 ` Chris Wilson
2015-10-09 12:00 ` Tomas Elf
2015-10-08 18:31 ` [PATCH 7/8] drm/i915: Grab execlist spinlock to avoid post-reset concurrency issues Tomas Elf
2015-10-09 7:45 ` Chris Wilson
2015-10-09 10:28 ` Tomas Elf
2015-10-09 8:38 ` Daniel Vetter
2015-10-09 8:45 ` Chris Wilson
2015-10-13 11:46 ` Daniel Vetter
2015-10-13 11:45 ` Chris Wilson
2015-10-13 13:46 ` Daniel Vetter
2015-10-13 14:00 ` Chris Wilson
2015-10-19 15:32 ` [PATCH v2 " Tomas Elf
2015-10-22 16:49 ` Dave Gordon
2015-10-22 17:35 ` Daniel Vetter
2015-10-23 8:42 ` Tvrtko Ursulin
2015-10-23 8:59 ` Daniel Vetter
2015-10-23 11:02 ` Tomas Elf
2015-10-23 12:49 ` Dave Gordon
2015-10-23 13:08 ` [PATCH v3 " Tomas Elf
2015-10-23 14:53 ` Daniel, Thomas
2015-10-23 17:02 ` [PATCH] drm/i915: Update to post-reset execlist queue clean-up Tomas Elf
2015-12-01 11:46 ` Tvrtko Ursulin
2015-12-11 14:14 ` Dave Gordon
2015-12-11 16:40 ` Daniel Vetter
2015-12-14 10:21 ` Mika Kuoppala
2015-10-08 18:31 ` [PATCH 8/8] drm/i915: NULL check of unpin_work Tomas Elf
2015-10-09 7:46 ` Chris Wilson
2015-10-09 8:39 ` Daniel Vetter
2015-10-09 11:50 ` Tomas Elf
2015-10-09 10:30 ` Tomas Elf
2015-10-09 10:44 ` Chris Wilson
2015-10-09 12:06 ` Tomas Elf
2015-10-13 11:51 ` Daniel Vetter
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=1444329100-19189-2-git-send-email-tomas.elf@intel.com \
--to=tomas.elf@intel.com \
--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.