From 9fda4eba37f4d9b5894fecc00b4dfb396d4c9aa5 Mon Sep 17 00:00:00 2001 From: Mika Kuoppala Date: Thu, 9 Jan 2014 17:21:23 +0200 Subject: [PATCH] drm/i915/ppgtt: Limit guilty hunt inside of relevant vm With full ppgtt, ACTHD is only relevant inside one context (address space). Trying to find guilty batch only relying on ACTHD, the result is false positives as ACTHD points inside batches on different address spaces. Filter out nonrelated contexts by checking on which vm the ring was running on when the hang happened. Only after finding the relevant vm, use acthd to find the guilty batch inside it. Signed-off-by: Mika Kuoppala --- drivers/gpu/drm/i915/i915_gem.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index af6b315..676d085 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -2282,9 +2282,34 @@ request_to_vm(struct drm_i915_gem_request *request) return vm; } +static bool +request_vm_active(struct drm_i915_gem_request *request) +{ + struct intel_ring_buffer *ring = request->ring; + struct drm_device *dev = ring->dev; + struct drm_i915_private *dev_priv = dev->dev_private; + struct i915_hw_ppgtt *ppgtt; + u32 pd_off; + + if (USES_FULL_PPGTT(dev) == false) + return true; + + if (WARN_ON(!request->ctx)) + return false; + + ppgtt = ctx_to_ppgtt(request->ctx); + + pd_off = (I915_READ(RING_PP_DIR_BASE(ring)) >> 16) * 64; + + return pd_off == ppgtt->pd_offset; +} + static bool i915_request_guilty(struct drm_i915_gem_request *request, const u32 acthd, bool *inside) { + if (!request_vm_active(request)) + return false; + /* There is a possibility that unmasked head address * pointing inside the ring, matches the batch_obj address range. * However this is extremely unlikely. -- 1.7.9.5