[PATCH 03/22] manual-throttle

Chris Wilson chris at chris-wilson.co.uk
Sun Aug 25 14:08:44 UTC 2019


---
 .../drm/i915/gem/selftests/i915_gem_context.c | 21 ++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c b/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
index 3d9029d5d410..4791d6155e63 100644
--- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
@@ -356,6 +356,7 @@ static int igt_ctx_exec(void *arg)
 	for_each_engine(engine, i915, id) {
 		struct drm_i915_gem_object *obj = NULL;
 		unsigned long ncontexts, ndwords, dw;
+		struct i915_request *throttle = NULL;
 		struct igt_live_test t;
 		struct drm_file *file;
 		IGT_TIMEOUT(end_time);
@@ -402,24 +403,42 @@ static int igt_ctx_exec(void *arg)
 			}
 
 			err = gpu_fill(ce, obj, dw);
-			intel_context_put(ce);
 
 			if (err) {
 				pr_err("Failed to fill dword %lu [%lu/%lu] with gpu (%s) in ctx %u [full-ppgtt? %s], err=%d\n",
 				       ndwords, dw, max_dwords(obj),
 				       engine->name, ctx->hw_id,
 				       yesno(!!ctx->vm), err);
+				intel_context_put(ce);
 				goto out_unlock;
 			}
 
 			if (++dw == max_dwords(obj)) {
+				if (throttle) {
+					i915_request_wait(throttle, 0, MAX_SCHEDULE_TIMEOUT);
+					i915_request_put(throttle);
+				}
+
+				throttle = intel_context_create_request(ce);
+				if (IS_ERR(throttle)) {
+					err = PTR_ERR(throttle);
+					intel_context_put(ce);
+					goto out_unlock;
+				}
+				i915_request_get(throttle);
+				i915_request_add(throttle);
+
 				obj = NULL;
 				dw = 0;
 			}
 
 			ndwords++;
 			ncontexts++;
+
+			intel_context_put(ce);
 		}
+		if (throttle)
+			i915_request_put(throttle);
 
 		pr_info("Submitted %lu contexts to %s, filling %lu dwords\n",
 			ncontexts, engine->name, ndwords);
-- 
2.23.0



More information about the Intel-gfx-trybot mailing list