drm/i915/selftests: Drain the freedlists between exec passes
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 4 Jul 2019 16:53:17 +0000 (17:53 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Thu, 4 Jul 2019 21:26:31 +0000 (22:26 +0100)
During the context execution tests, we issue a lot of work and discard a
lot of objects without releasing the lock and allowing the background
reaper to free those objects. Insert a small break between each pass to
flush the worker.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190704165317.21060-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c

index a23c6df9b9f465e99b8a61fa100b896b8d22edea..91d13f01926555235e1bf547f42f866ea42bb61b 100644 (file)
@@ -562,6 +562,8 @@ out_unlock:
                mock_file_free(i915, file);
                if (err)
                        return err;
+
+               i915_gem_drain_freed_objects(i915);
        }
 
        return 0;
@@ -672,6 +674,10 @@ static int igt_shared_ctx_exec(void *arg)
 
                        dw += rem;
                }
+
+               mutex_unlock(&i915->drm.struct_mutex);
+               i915_gem_drain_freed_objects(i915);
+               mutex_lock(&i915->drm.struct_mutex);
        }
 out_test:
        if (igt_live_test_end(&t))