drm/i915: Leave vma intact as they are discarded
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 11 Jun 2020 18:04:21 +0000 (19:04 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 12 Jun 2020 09:13:07 +0000 (10:13 +0100)
commit51dc276dd2af20ae9468afbd864fa8b0e1c75827
treef0ff22611b4e4ccc956de2e7317f19e8a12853b4
parent94641eb6c69682884abbecf22fe5b7c185af6a06
drm/i915: Leave vma intact as they are discarded

If we find ourselves trying to reuse a misplaced but active vma, we
currently try to discard it to avoid having to wait to unbind it
(upsetting the current user fo the vma). An alternative to marking it as
a dicarded vma and keeping it in both the obj->vma.list and
obj->vma.tree, is to simply remove it from the lookup rbtree.

While it remains in the list of vma, it will be unbound under eviction
pressure and freed along with the object. We will never reuse it again
for new instances. As before, with no pruning, the list may continually
grow, but eventually we will have the most constrained version of the
ggtt view that meets all requirements -- so the list of vma should not
grow without bound.

Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/2012
Fixes: 9bdcaa5e3a2f ("drm/i915: Discard a misplaced GGTT vma")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200611180421.23262-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/i915_vma.c