]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drm/i915: Assert no external observers when unwind a failed request alloc
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 25 Nov 2016 13:17:16 +0000 (13:17 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 25 Nov 2016 13:49:24 +0000 (13:49 +0000)
Before we return the request back to the kmem_cache after a failed
i915_gem_request_alloc(), we should assert that it has not been added to
any global state tracking.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161125131718.20978-2-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/i915_gem_request.c

index bd7b21f702830288dc572bb1e1411ed66a21a0a9..ed6cead22a86befa87a69cd55d04feb1e675fdd9 100644 (file)
@@ -599,6 +599,11 @@ i915_gem_request_alloc(struct intel_engine_cs *engine,
        return req;
 
 err_ctx:
+       /* Make sure we didn't add ourselves to external state before freeing */
+       GEM_BUG_ON(!list_empty(&req->active_list));
+       GEM_BUG_ON(!list_empty(&req->priotree.signalers_list));
+       GEM_BUG_ON(!list_empty(&req->priotree.waiters_list));
+
        i915_gem_context_put(ctx);
        kmem_cache_free(dev_priv->requests, req);
 err_unreserve: