]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
Revert "drm/i915: Clean up associated VMAs on context destruction"
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 4 Aug 2016 06:52:47 +0000 (07:52 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Thu, 4 Aug 2016 07:09:34 +0000 (08:09 +0100)
This reverts commit e9f24d5fb7cf3628b195b18ff3ac4e37937ceeae.

The patch was only a stop-gap measure that fixed half the problem - the
leak of the fbcon when restarting X. A complete solution required
releasing the VMA when the object itself was closed rather than rely on
file/process exit. The previous patches add the VMA tracking necessary
to do close them along with the object, context or file, and so the time
has come to remove the partial fix.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1470293567-10811-28-git-send-email-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/i915_gem_context.c
drivers/gpu/drm/i915/i915_gem_gtt.c

index ce472c9bd7f942e12de7b465ccf331f22fc78f9e..66b98fa4715a5d365bf354f58542a891857a2090 100644 (file)
@@ -3044,11 +3044,6 @@ int i915_vma_bind(struct i915_vma *vma, enum i915_cache_level cache_level,
                  u32 flags);
 void __i915_vma_set_map_and_fenceable(struct i915_vma *vma);
 int __must_check i915_vma_unbind(struct i915_vma *vma);
-/*
- * BEWARE: Do not use the function below unless you can _absolutely_
- * _guarantee_ VMA in question is _not in use_ anywhere.
- */
-int __must_check __i915_vma_unbind_no_wait(struct i915_vma *vma);
 void i915_vma_close(struct i915_vma *vma);
 void i915_vma_destroy(struct i915_vma *vma);
 
index 85a06dcb2f84f7314f67fa304b9ea78f4d67bb78..86ff14c63204d5aad7ea81313fe28410a37e9236 100644 (file)
@@ -2803,7 +2803,7 @@ static void __i915_vma_iounmap(struct i915_vma *vma)
        vma->iomap = NULL;
 }
 
-static int __i915_vma_unbind(struct i915_vma *vma, bool wait)
+int i915_vma_unbind(struct i915_vma *vma)
 {
        struct drm_i915_gem_object *obj = vma->obj;
        unsigned long active;
@@ -2813,7 +2813,7 @@ static int __i915_vma_unbind(struct i915_vma *vma, bool wait)
         * have side-effects such as unpinning or even unbinding this vma.
         */
        active = i915_vma_get_active(vma);
-       if (active && wait) {
+       if (active) {
                int idx;
 
                /* When a closed VMA is retired, it is unbound - eek.
@@ -2895,16 +2895,6 @@ destroy:
        return 0;
 }
 
-int i915_vma_unbind(struct i915_vma *vma)
-{
-       return __i915_vma_unbind(vma, true);
-}
-
-int __i915_vma_unbind_no_wait(struct i915_vma *vma)
-{
-       return __i915_vma_unbind(vma, false);
-}
-
 int i915_gem_wait_for_idle(struct drm_i915_private *dev_priv)
 {
        struct intel_engine_cs *engine;
index a4ee62335e755669f8f171283122c63d35a99a7c..eff6d3953ecd5616810c1c97ad70e34e9f8513b8 100644 (file)
@@ -134,21 +134,6 @@ static int get_context_size(struct drm_i915_private *dev_priv)
        return ret;
 }
 
-static void i915_gem_context_clean(struct i915_gem_context *ctx)
-{
-       struct i915_hw_ppgtt *ppgtt = ctx->ppgtt;
-       struct i915_vma *vma, *next;
-
-       if (!ppgtt)
-               return;
-
-       list_for_each_entry_safe(vma, next, &ppgtt->base.inactive_list,
-                                vm_link) {
-               if (WARN_ON(__i915_vma_unbind_no_wait(vma)))
-                       break;
-       }
-}
-
 void i915_gem_context_free(struct kref *ctx_ref)
 {
        struct i915_gem_context *ctx = container_of(ctx_ref, typeof(*ctx), ref);
@@ -158,13 +143,6 @@ void i915_gem_context_free(struct kref *ctx_ref)
        trace_i915_context_free(ctx);
        GEM_BUG_ON(!ctx->closed);
 
-       /*
-        * This context is going away and we need to remove all VMAs still
-        * around. This is to handle imported shared objects for which
-        * destructor did not run when their handles were closed.
-        */
-       i915_gem_context_clean(ctx);
-
        i915_ppgtt_put(ctx->ppgtt);
 
        for (i = 0; i < I915_NUM_ENGINES; i++) {
index d42463c3ff668f1d034c590708991cb948781436..685ca2aaada8dbaae95d664e3acf77ed353b1ea2 100644 (file)
@@ -3368,7 +3368,7 @@ void i915_vma_close(struct i915_vma *vma)
 
        list_del_init(&vma->obj_link);
        if (!i915_vma_is_active(vma) && !vma->pin_count)
-               WARN_ON(__i915_vma_unbind_no_wait(vma));
+               WARN_ON(i915_vma_unbind(vma));
 }
 
 static struct i915_vma *