drm/i915/breadcrumbs: Update bottom-half before marking as complete
authorChris Wilson <chris@chris-wilson.co.uk>
Wed, 15 Mar 2017 21:07:23 +0000 (21:07 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Wed, 15 Mar 2017 21:45:38 +0000 (21:45 +0000)
commit429732e860fda07fc1bb96fe23c43146c27e08e0
tree19da7b56432bddd155b8df604b14244facdbde45
parent4bd66391dd34399b734b11203eb3bf39e7f43bf0
drm/i915/breadcrumbs: Update bottom-half before marking as complete

When adding a new request to the breadcrumb rbtree, we mark all those
requests inside the rbtree that are already completed as complete. This
wakes those waiters up and allows them to skip the spinlock before
returning to userspace. If one of those is the current bottom-half and
allocated its intel_wait on the stack, it may then overwrite the
b->irq_wait upon exiting i915_wait_request() just as the interrupt handler
dereferences it.

Fixes: 56299fb7d904 ("drm/i915: Signal first fence from irq handler if complete")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170315210726.12095-2-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/intel_breadcrumbs.c