drm/i915: Fix unsafe loop iteration over vma whilst unbinding them
authorChris Wilson <chris@chris-wilson.co.uk>
Wed, 21 May 2014 09:07:24 +0000 (11:07 +0200)
committerJiri Slaby <jslaby@suse.cz>
Mon, 9 Jun 2014 13:53:47 +0000 (15:53 +0200)
commit918f7a4a723a633a0a3fdbc30894b070cdcbe9ea
tree7d78cfd524d879e735365df2611d05681eaf8ff1
parent93ddf2615c02e3071f34c294a82dc28d19a6a6b0
drm/i915: Fix unsafe loop iteration over vma whilst unbinding them

This is commit df6f783a4ef6790780a67c491897ac upstream.

On non-LLC platforms, when changing the cache level of an object, we may
need to unbind it so that prefetching across page boundaries does not
cross into a different memory domain. This requires us to unbind
conflicting vma, but we did so iterating over the objects vma in an
unsafe manner (as the list was being modified as we iterated).

The regression was introduced in
commit 3089c6f239d7d2c4cb2dd5c353e8984cf79af1d7
Author: Ben Widawsky <ben@bwidawsk.net>
Date:   Wed Jul 31 17:00:03 2013 -0700

    drm/i915: make caching operate on all address spaces
apparently as far back as v3.12-rc1, but it has only just begun to
trigger real world bug reports.

Reported-and-tested-by: Nikolay Martynov <mar.kolya@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76384
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
drivers/gpu/drm/i915/i915_gem.c