Commit 39d3cc03 authored by Chris Wilson's avatar Chris Wilson

drm/i915/selftests: Wait longer for the old active request

When testing reset, we wait for 1s on the main thread for the hang to
start. Meanwhile, we continue submitting requests on all the background
threads, and we may have more threads than cores and so potentially
starve the waiter from being woken within the timeout. As the hang
timeout and the active timeouts are the same, it is hard to distinguish
which caused the timeout. Bump the active thread timeouts to 5s,
compared to the 1s timeout for the hang, so that we preferentially
report the hang timing out, while hopefully ensuring that we do at least
wake up the hang thread first before declaring the background active
timeout.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20180517142442.16979-1-chris@chris-wilson.co.ukReviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
parent 2399a4a6
...@@ -563,6 +563,30 @@ struct active_engine { ...@@ -563,6 +563,30 @@ struct active_engine {
#define TEST_SELF BIT(2) #define TEST_SELF BIT(2)
#define TEST_PRIORITY BIT(3) #define TEST_PRIORITY BIT(3)
static int active_request_put(struct i915_request *rq)
{
int err = 0;
if (!rq)
return 0;
if (i915_request_wait(rq, 0, 5 * HZ) < 0) {
GEM_TRACE("%s timed out waiting for completion of fence %llx:%d, seqno %d.\n",
rq->engine->name,
rq->fence.context,
rq->fence.seqno,
i915_request_global_seqno(rq));
GEM_TRACE_DUMP();
i915_gem_set_wedged(rq->i915);
err = -EIO;
}
i915_request_put(rq);
return err;
}
static int active_engine(void *data) static int active_engine(void *data)
{ {
I915_RND_STATE(prng); I915_RND_STATE(prng);
...@@ -611,24 +635,20 @@ static int active_engine(void *data) ...@@ -611,24 +635,20 @@ static int active_engine(void *data)
i915_request_add(new); i915_request_add(new);
mutex_unlock(&engine->i915->drm.struct_mutex); mutex_unlock(&engine->i915->drm.struct_mutex);
if (old) { err = active_request_put(old);
if (i915_request_wait(old, 0, HZ) < 0) { if (err)
GEM_TRACE("%s timed out.\n", engine->name);
GEM_TRACE_DUMP();
i915_gem_set_wedged(engine->i915);
i915_request_put(old);
err = -EIO;
break; break;
}
i915_request_put(old);
}
cond_resched(); cond_resched();
} }
for (count = 0; count < ARRAY_SIZE(rq); count++) for (count = 0; count < ARRAY_SIZE(rq); count++) {
i915_request_put(rq[count]); int err__ = active_request_put(rq[count]);
/* Keep the first error */
if (!err)
err = err__;
}
err_file: err_file:
mock_file_free(engine->i915, file); mock_file_free(engine->i915, file);
......
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