drm/i915/selftests: Finish pending mock requests on cancellation.
Flush all the pending requests from the mock engine when they are cancelled. 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/20200930163253.2789-2-chris@chris-wilson.co.uk
This commit is contained in:
parent
5e39b4d94c
commit
eb3afbe18e
@ -245,18 +245,39 @@ static void mock_reset_rewind(struct intel_engine_cs *engine, bool stalled)
|
||||
GEM_BUG_ON(stalled);
|
||||
}
|
||||
|
||||
static void mark_eio(struct i915_request *rq)
|
||||
{
|
||||
if (i915_request_completed(rq))
|
||||
return;
|
||||
|
||||
GEM_BUG_ON(i915_request_signaled(rq));
|
||||
|
||||
i915_request_set_error_once(rq, -EIO);
|
||||
i915_request_mark_complete(rq);
|
||||
}
|
||||
|
||||
static void mock_reset_cancel(struct intel_engine_cs *engine)
|
||||
{
|
||||
struct i915_request *request;
|
||||
struct mock_engine *mock =
|
||||
container_of(engine, typeof(*mock), base);
|
||||
struct i915_request *rq;
|
||||
unsigned long flags;
|
||||
|
||||
del_timer_sync(&mock->hw_delay);
|
||||
|
||||
spin_lock_irqsave(&engine->active.lock, flags);
|
||||
|
||||
/* Mark all submitted requests as skipped. */
|
||||
list_for_each_entry(request, &engine->active.requests, sched.link) {
|
||||
i915_request_set_error_once(request, -EIO);
|
||||
i915_request_mark_complete(request);
|
||||
list_for_each_entry(rq, &engine->active.requests, sched.link)
|
||||
mark_eio(rq);
|
||||
intel_engine_signal_breadcrumbs(engine);
|
||||
|
||||
/* Cancel and submit all pending requests. */
|
||||
list_for_each_entry(rq, &mock->hw_queue, mock.link) {
|
||||
mark_eio(rq);
|
||||
__i915_request_submit(rq);
|
||||
}
|
||||
INIT_LIST_HEAD(&mock->hw_queue);
|
||||
|
||||
spin_unlock_irqrestore(&engine->active.lock, flags);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user