drm/i915: Initialise userptr mmu_notifier serial to 1
commit6c308fecb4d1f928d52f9586d976f79b37149388
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 11 Jul 2014 10:28:01 +0000 (11 11:28 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 23 Jul 2014 05:05:29 +0000 (23 07:05 +0200)
tree9df62d8076c5d0cccedd82def542fb96c5ea1322
parenta1db2fa7c8325a380792d66908b2f982cf047837
drm/i915: Initialise userptr mmu_notifier serial to 1

During the range invalidate, we walk the list of buffers associated with
the mmu_notifer and find the ones that overlap the range. An
optimisation is made to speed up the iteration by assuming the previous
iter is still valid whilst the tree is unmodified. This exposes a bug
when a range invalidate is triggered after we have just created the
mmu_notifier, but before attaching any buffers. In that case, we presume
we have an unmodified list and start walking from the last iter which is
NULL. Oops.

The easiest fix is then to initialise the serial of the tree to 1.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Testecase: igt/gem_userptr_blts/stress-mm
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_gem_userptr.c