]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/selftests: Make the mman object busy everywhere
authorChris Wilson <chris@chris-wilson.co.uk>
Tue, 22 Oct 2019 10:17:04 +0000 (11:17 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Tue, 22 Oct 2019 11:16:42 +0000 (12:16 +0100)
Loop over all engines, issuing a request for the object on each in order
to make sure we leave no stone unturned when creating an active ref. The
purpose is to make sure that we can reap a zombie object (one that is
only alive due to an active reference on the GPU) no matter where that
active reference emanates from.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191022101704.5618-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c

index 65d4dbf919996a1442ee199cf8f2662f173605cf..d45a93928ff5d246c0cdda54fe5d4e6d2a1e09cd 100644 (file)
@@ -515,20 +515,19 @@ static int make_obj_busy(struct drm_i915_gem_object *obj)
 {
        struct drm_i915_private *i915 = to_i915(obj->base.dev);
        struct intel_engine_cs *engine;
-       enum intel_engine_id id;
-       struct i915_vma *vma;
-       int err;
 
-       vma = i915_vma_instance(obj, &i915->ggtt.vm, NULL);
-       if (IS_ERR(vma))
-               return PTR_ERR(vma);
+       for_each_uabi_engine(engine, i915) {
+               struct i915_request *rq;
+               struct i915_vma *vma;
+               int err;
 
-       err = i915_vma_pin(vma, 0, 0, PIN_USER);
-       if (err)
-               return err;
+               vma = i915_vma_instance(obj, &engine->gt->ggtt->vm, NULL);
+               if (IS_ERR(vma))
+                       return PTR_ERR(vma);
 
-       for_each_engine(engine, i915, id) {
-               struct i915_request *rq;
+               err = i915_vma_pin(vma, 0, 0, PIN_USER);
+               if (err)
+                       return err;
 
                rq = i915_request_create(engine->kernel_context);
                if (IS_ERR(rq)) {
@@ -544,12 +543,13 @@ static int make_obj_busy(struct drm_i915_gem_object *obj)
                i915_vma_unlock(vma);
 
                i915_request_add(rq);
+               i915_vma_unpin(vma);
+               if (err)
+                       return err;
        }
 
-       i915_vma_unpin(vma);
        i915_gem_object_put(obj); /* leave it only alive via its active ref */
-
-       return err;
+       return 0;
 }
 
 static bool assert_mmap_offset(struct drm_i915_private *i915,