Commit e60a870d authored by Chris Wilson's avatar Chris Wilson

drm/i915: Assert that fence->lock is held in an irq-safe manner

Everytime we take the fence->lock (aka request->lock), we must do so
with irqs disabled since it may be used from within an hardirq context.
As sometimes we are taking the lock in a nested manner, assert that the
caller did disable the irqs for us.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302115130.28434-1-chris@chris-wilson.co.ukReviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
parent a5509abd
...@@ -400,12 +400,14 @@ void __i915_gem_request_submit(struct drm_i915_gem_request *request) ...@@ -400,12 +400,14 @@ void __i915_gem_request_submit(struct drm_i915_gem_request *request)
struct intel_timeline *timeline; struct intel_timeline *timeline;
u32 seqno; u32 seqno;
GEM_BUG_ON(!irqs_disabled());
assert_spin_locked(&engine->timeline->lock);
trace_i915_gem_request_execute(request); trace_i915_gem_request_execute(request);
/* Transfer from per-context onto the global per-engine timeline */ /* Transfer from per-context onto the global per-engine timeline */
timeline = engine->timeline; timeline = engine->timeline;
GEM_BUG_ON(timeline == request->timeline); GEM_BUG_ON(timeline == request->timeline);
assert_spin_locked(&timeline->lock);
seqno = timeline_get_seqno(timeline); seqno = timeline_get_seqno(timeline);
GEM_BUG_ON(!seqno); GEM_BUG_ON(!seqno);
...@@ -446,6 +448,7 @@ void __i915_gem_request_unsubmit(struct drm_i915_gem_request *request) ...@@ -446,6 +448,7 @@ void __i915_gem_request_unsubmit(struct drm_i915_gem_request *request)
struct intel_engine_cs *engine = request->engine; struct intel_engine_cs *engine = request->engine;
struct intel_timeline *timeline; struct intel_timeline *timeline;
GEM_BUG_ON(!irqs_disabled());
assert_spin_locked(&engine->timeline->lock); assert_spin_locked(&engine->timeline->lock);
/* Only unwind in reverse order, required so that the per-context list /* Only unwind in reverse order, required so that the per-context list
......
...@@ -653,6 +653,7 @@ void intel_engine_enable_signaling(struct drm_i915_gem_request *request) ...@@ -653,6 +653,7 @@ void intel_engine_enable_signaling(struct drm_i915_gem_request *request)
*/ */
/* locked by dma_fence_enable_sw_signaling() (irqsafe fence->lock) */ /* locked by dma_fence_enable_sw_signaling() (irqsafe fence->lock) */
GEM_BUG_ON(!irqs_disabled());
assert_spin_locked(&request->lock); assert_spin_locked(&request->lock);
seqno = i915_gem_request_global_seqno(request); seqno = i915_gem_request_global_seqno(request);
...@@ -709,6 +710,7 @@ void intel_engine_cancel_signaling(struct drm_i915_gem_request *request) ...@@ -709,6 +710,7 @@ void intel_engine_cancel_signaling(struct drm_i915_gem_request *request)
struct intel_engine_cs *engine = request->engine; struct intel_engine_cs *engine = request->engine;
struct intel_breadcrumbs *b = &engine->breadcrumbs; struct intel_breadcrumbs *b = &engine->breadcrumbs;
GEM_BUG_ON(!irqs_disabled());
assert_spin_locked(&request->lock); assert_spin_locked(&request->lock);
GEM_BUG_ON(!request->signaling.wait.seqno); GEM_BUG_ON(!request->signaling.wait.seqno);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment