diff mbox

drm/i915: WARN if asked to wait on an impossible future seqno

Message ID 1348130526-24362-1-git-send-email-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson Sept. 20, 2012, 8:42 a.m. UTC
On the hunt for an indefinite __wait_seqno() the most likely cause being
asked to wait upon a future seqno, we can lay a trap and see if anything
gets caught.

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

Comments

Daniel Vetter Sept. 20, 2012, 9:30 a.m. UTC | #1
On Thu, Sep 20, 2012 at 10:42 AM, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> On the hunt for an indefinite __wait_seqno() the most likely cause being
> asked to wait upon a future seqno, we can lay a trap and see if anything
> gets caught.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/i915_gem.c |    6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 39de523..b2effab 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -1118,6 +1118,12 @@ static int __wait_seqno(struct intel_ring_buffer *ring, u32 seqno,
>         bool wait_forever = true;
>         int ret;
>
> +       if (WARN_ON(!i915_seqno_passed(list_entry(ring->request_list.prev,
> +                                                 struct drm_i915_gem_request,
> +                                                 list)->seqno,
> +                                      seqno)))
> +               return -EDEADLK;
> +

I think dumping the seqno, ring->olr, dev_priv->next_seqno and the
seqno of the last request would be good to debug any such indefinite
wait ...
-Daniel

>         if (i915_seqno_passed(ring->get_seqno(ring, true), seqno))
>                 return 0;
>
> --
> 1.7.10.4
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 39de523..b2effab 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1118,6 +1118,12 @@  static int __wait_seqno(struct intel_ring_buffer *ring, u32 seqno,
 	bool wait_forever = true;
 	int ret;
 
+	if (WARN_ON(!i915_seqno_passed(list_entry(ring->request_list.prev,
+						  struct drm_i915_gem_request,
+						  list)->seqno,
+				       seqno)))
+		return -EDEADLK;
+
 	if (i915_seqno_passed(ring->get_seqno(ring, true), seqno))
 		return 0;