Some testing environments and some heavier tests are slower than previous limits allowed for. For example, it can take multiple seconds for the 'context has been reset' notification handler to reach the 'kill the requests' code in the 'active' version of the 'reset engines' test. During which time the selftest gets bored, gives up waiting and fails the test. There is also an async thread that the selftest uses to pump work through the hardware in parallel to the context that is marked for reset. That also could get bored waiting for completions and kill the test off. Lastly, the flush at the of various test sections can also see timeouts due to the large amount of work backed up. This is also true of the live_hwsp_read test. Signed-off-by: John Harrison <John.C.Harrison@Intel.com> Signed-off-by: Matthew Brost <matthew.brost@intel.com> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Reviewed-by: Matthew Brost <matthew.brost@intel.com> Signed-off-by: John Harrison <John.C.Harrison@Intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20210727002348.97202-32-matthew.brost@intel.com
89 lines
2.2 KiB
C
89 lines
2.2 KiB
C
// SPDX-License-Identifier: MIT
|
|
/*
|
|
* Copyright © 2021 Intel Corporation
|
|
*/
|
|
|
|
//#include "gt/intel_engine_user.h"
|
|
#include "gt/intel_gt.h"
|
|
#include "i915_drv.h"
|
|
#include "i915_selftest.h"
|
|
|
|
#include "selftests/intel_scheduler_helpers.h"
|
|
|
|
#define REDUCED_TIMESLICE 5
|
|
#define REDUCED_PREEMPT 10
|
|
#define WAIT_FOR_RESET_TIME 10000
|
|
|
|
int intel_selftest_modify_policy(struct intel_engine_cs *engine,
|
|
struct intel_selftest_saved_policy *saved,
|
|
u32 modify_type)
|
|
|
|
{
|
|
int err;
|
|
|
|
saved->reset = engine->i915->params.reset;
|
|
saved->flags = engine->flags;
|
|
saved->timeslice = engine->props.timeslice_duration_ms;
|
|
saved->preempt_timeout = engine->props.preempt_timeout_ms;
|
|
|
|
switch (modify_type) {
|
|
case SELFTEST_SCHEDULER_MODIFY_FAST_RESET:
|
|
/*
|
|
* Enable force pre-emption on time slice expiration
|
|
* together with engine reset on pre-emption timeout.
|
|
* This is required to make the GuC notice and reset
|
|
* the single hanging context.
|
|
* Also, reduce the preemption timeout to something
|
|
* small to speed the test up.
|
|
*/
|
|
engine->i915->params.reset = 2;
|
|
engine->flags |= I915_ENGINE_WANT_FORCED_PREEMPTION;
|
|
engine->props.timeslice_duration_ms = REDUCED_TIMESLICE;
|
|
engine->props.preempt_timeout_ms = REDUCED_PREEMPT;
|
|
break;
|
|
|
|
case SELFTEST_SCHEDULER_MODIFY_NO_HANGCHECK:
|
|
engine->props.preempt_timeout_ms = 0;
|
|
break;
|
|
|
|
default:
|
|
pr_err("Invalid scheduler policy modification type: %d!\n", modify_type);
|
|
return -EINVAL;
|
|
}
|
|
|
|
if (!intel_engine_uses_guc(engine))
|
|
return 0;
|
|
|
|
err = intel_guc_global_policies_update(&engine->gt->uc.guc);
|
|
if (err)
|
|
intel_selftest_restore_policy(engine, saved);
|
|
|
|
return err;
|
|
}
|
|
|
|
int intel_selftest_restore_policy(struct intel_engine_cs *engine,
|
|
struct intel_selftest_saved_policy *saved)
|
|
{
|
|
/* Restore the original policies */
|
|
engine->i915->params.reset = saved->reset;
|
|
engine->flags = saved->flags;
|
|
engine->props.timeslice_duration_ms = saved->timeslice;
|
|
engine->props.preempt_timeout_ms = saved->preempt_timeout;
|
|
|
|
if (!intel_engine_uses_guc(engine))
|
|
return 0;
|
|
|
|
return intel_guc_global_policies_update(&engine->gt->uc.guc);
|
|
}
|
|
|
|
int intel_selftest_wait_for_rq(struct i915_request *rq)
|
|
{
|
|
long ret;
|
|
|
|
ret = i915_request_wait(rq, 0, WAIT_FOR_RESET_TIME);
|
|
if (ret < 0)
|
|
return ret;
|
|
|
|
return 0;
|
|
}
|