Commit c8d84778 authored by Chris Wilson's avatar Chris Wilson

drm/i915/selftests: Hold ref on request across waits

As we wait upon the request, we should be sure to hold our own reference
for our checks.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarMatthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190625130128.11009-14-chris@chris-wilson.co.uk
parent 5f22e5b3
...@@ -75,55 +75,58 @@ static int igt_wait_request(void *arg) ...@@ -75,55 +75,58 @@ static int igt_wait_request(void *arg)
err = -ENOMEM; err = -ENOMEM;
goto out_unlock; goto out_unlock;
} }
i915_request_get(request);
if (i915_request_wait(request, 0, 0) != -ETIME) { if (i915_request_wait(request, 0, 0) != -ETIME) {
pr_err("request wait (busy query) succeeded (expected timeout before submit!)\n"); pr_err("request wait (busy query) succeeded (expected timeout before submit!)\n");
goto out_unlock; goto out_request;
} }
if (i915_request_wait(request, 0, T) != -ETIME) { if (i915_request_wait(request, 0, T) != -ETIME) {
pr_err("request wait succeeded (expected timeout before submit!)\n"); pr_err("request wait succeeded (expected timeout before submit!)\n");
goto out_unlock; goto out_request;
} }
if (i915_request_completed(request)) { if (i915_request_completed(request)) {
pr_err("request completed before submit!!\n"); pr_err("request completed before submit!!\n");
goto out_unlock; goto out_request;
} }
i915_request_add(request); i915_request_add(request);
if (i915_request_wait(request, 0, 0) != -ETIME) { if (i915_request_wait(request, 0, 0) != -ETIME) {
pr_err("request wait (busy query) succeeded (expected timeout after submit!)\n"); pr_err("request wait (busy query) succeeded (expected timeout after submit!)\n");
goto out_unlock; goto out_request;
} }
if (i915_request_completed(request)) { if (i915_request_completed(request)) {
pr_err("request completed immediately!\n"); pr_err("request completed immediately!\n");
goto out_unlock; goto out_request;
} }
if (i915_request_wait(request, 0, T / 2) != -ETIME) { if (i915_request_wait(request, 0, T / 2) != -ETIME) {
pr_err("request wait succeeded (expected timeout!)\n"); pr_err("request wait succeeded (expected timeout!)\n");
goto out_unlock; goto out_request;
} }
if (i915_request_wait(request, 0, T) == -ETIME) { if (i915_request_wait(request, 0, T) == -ETIME) {
pr_err("request wait timed out!\n"); pr_err("request wait timed out!\n");
goto out_unlock; goto out_request;
} }
if (!i915_request_completed(request)) { if (!i915_request_completed(request)) {
pr_err("request not complete after waiting!\n"); pr_err("request not complete after waiting!\n");
goto out_unlock; goto out_request;
} }
if (i915_request_wait(request, 0, T) == -ETIME) { if (i915_request_wait(request, 0, T) == -ETIME) {
pr_err("request wait timed out when already complete!\n"); pr_err("request wait timed out when already complete!\n");
goto out_unlock; goto out_request;
} }
err = 0; err = 0;
out_request:
i915_request_put(request);
out_unlock: out_unlock:
mock_device_flush(i915); mock_device_flush(i915);
mutex_unlock(&i915->drm.struct_mutex); mutex_unlock(&i915->drm.struct_mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment