aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorTomas Elf <tomas.elf@intel.com>2015-10-08 14:31:33 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-10-09 04:22:38 -0400
commit381e8ae377d9f0708a5073cb6ee2fa24ef303623 (patch)
tree11342155c9ac4d1484fcef2e0ce1f878942cd2f0 /drivers/gpu
parent61fb58815192c558d74016721dae6235c18c0fbf (diff)
drm/i915: Early exit from semaphore_waits_for for execlist mode.
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> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/i915/i915_irq.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index bd56ca629b31..637c13211613 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -2784,6 +2784,26 @@ semaphore_waits_for(struct intel_engine_cs *ring, u32 *seqno)
2784 u64 offset = 0; 2784 u64 offset = 0;
2785 int i, backwards; 2785 int i, backwards;
2786 2786
2787 /*
2788 * This function does not support execlist mode - any attempt to
2789 * proceed further into this function will result in a kernel panic
2790 * when dereferencing ring->buffer, which is not set up in execlist
2791 * mode.
2792 *
2793 * The correct way of doing it would be to derive the currently
2794 * executing ring buffer from the current context, which is derived
2795 * from the currently running request. Unfortunately, to get the
2796 * current request we would have to grab the struct_mutex before doing
2797 * anything else, which would be ill-advised since some other thread
2798 * might have grabbed it already and managed to hang itself, causing
2799 * the hang checker to deadlock.
2800 *
2801 * Therefore, this function does not support execlist mode in its
2802 * current form. Just return NULL and move on.
2803 */
2804 if (ring->buffer == NULL)
2805 return NULL;
2806
2787 ipehr = I915_READ(RING_IPEHR(ring->mmio_base)); 2807 ipehr = I915_READ(RING_IPEHR(ring->mmio_base));
2788 if (!ipehr_is_semaphore_wait(ring->dev, ipehr)) 2808 if (!ipehr_is_semaphore_wait(ring->dev, ipehr))
2789 return NULL; 2809 return NULL;