]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
drm/i915: Remove vma from object on destroy, not close
authorChris Wilson <chris@chris-wilson.co.uk>
Wed, 6 Dec 2017 12:49:13 +0000 (12:49 +0000)
committerJuerg Haefliger <juergh@canonical.com>
Wed, 24 Jul 2019 01:51:23 +0000 (19:51 -0600)
BugLink: https://bugs.launchpad.net/bugs/1836287
commit 010e3e68cd9cb65ea50c0af605e966cda333cb2a upstream.

Originally we translated from the object to the vma by walking
obj->vma_list to find the matching vm (for user lookups). Now we process
user lookups using the rbtree, and we only use obj->vma_list itself for
maintaining state (e.g. ensuring that all vma are flushed or rebound).
As such maintenance needs to go on beyond the user's awareness of the
vma, defer removal of the vma from the obj->vma_list from i915_vma_close()
to i915_vma_destroy()

Fixes: 5888fc9eac3c ("drm/i915: Flush pending GTT writes before unbinding")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104155
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171206124914.19960-1-chris@chris-wilson.co.uk
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/i915_vma.c

index 2945232cd29a36ed39071660ac3593544876e586..f6bb9ea796bbb3c0e0818ff8f1c07194465b8979 100644 (file)
@@ -3695,7 +3695,8 @@ restart:
                        return -EBUSY;
                }
 
-               if (i915_gem_valid_gtt_space(vma, cache_level))
+               if (!i915_vma_is_closed(vma) &&
+                   i915_gem_valid_gtt_space(vma, cache_level))
                        continue;
 
                ret = i915_vma_unbind(vma);
index 1f14c76b5e35cb705b2d1f3eebbc8c3d42f01adb..7c4ab4263d33a9bc234d5b42d3d04482521d4c2e 100644 (file)
@@ -466,6 +466,7 @@ i915_vma_insert(struct i915_vma *vma, u64 size, u64 alignment, u64 flags)
        u64 start, end;
        int ret;
 
+       GEM_BUG_ON(i915_vma_is_closed(vma));
        GEM_BUG_ON(vma->flags & (I915_VMA_GLOBAL_BIND | I915_VMA_LOCAL_BIND));
        GEM_BUG_ON(drm_mm_node_allocated(&vma->node));
 
@@ -675,7 +676,9 @@ static void i915_vma_destroy(struct i915_vma *vma)
                GEM_BUG_ON(i915_gem_active_isset(&vma->last_read[i]));
        GEM_BUG_ON(i915_gem_active_isset(&vma->last_fence));
 
+       list_del(&vma->obj_link);
        list_del(&vma->vm_link);
+
        if (!i915_vma_is_ggtt(vma))
                i915_ppgtt_put(i915_vm_to_ppgtt(vma->vm));
 
@@ -687,7 +690,6 @@ void i915_vma_close(struct i915_vma *vma)
        GEM_BUG_ON(i915_vma_is_closed(vma));
        vma->flags |= I915_VMA_CLOSED;
 
-       list_del(&vma->obj_link);
        rb_erase(&vma->obj_node, &vma->obj->vma_tree);
 
        if (!i915_vma_is_active(vma) && !i915_vma_is_pinned(vma))