Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d9e61b66 authored by Chris Wilson's avatar Chris Wilson
Browse files

drm/i915: Defer application of request banning to submission



As we currently do not check on submission whether the context is banned
in a timely manner it is possible for some requests to escape
cancellation after their parent context is banned. By moving the ban
into the request submission under the engine->timeline.lock, we
serialise it with the reset and setting of the context ban.

References: eb8d0f5a ("drm/i915: Remove GPU reset dependence on struct_mutex")
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190213182737.12695-1-chris@chris-wilson.co.uk


Reviewed-by: default avatarMika Kuoppala <mika.kuoppala@intel.com>
parent c836eb79
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -366,6 +366,9 @@ void __i915_request_submit(struct i915_request *request)
	GEM_BUG_ON(!irqs_disabled());
	GEM_BUG_ON(!irqs_disabled());
	lockdep_assert_held(&engine->timeline.lock);
	lockdep_assert_held(&engine->timeline.lock);


	if (i915_gem_context_is_banned(request->gem_context))
		i915_request_skip(request, -EIO);

	GEM_BUG_ON(request->global_seqno);
	GEM_BUG_ON(request->global_seqno);


	seqno = next_global_seqno(&engine->timeline);
	seqno = next_global_seqno(&engine->timeline);
+5 −14
Original line number Original line Diff line number Diff line
@@ -22,26 +22,17 @@ static void engine_skip_context(struct i915_request *rq)
{
{
	struct intel_engine_cs *engine = rq->engine;
	struct intel_engine_cs *engine = rq->engine;
	struct i915_gem_context *hung_ctx = rq->gem_context;
	struct i915_gem_context *hung_ctx = rq->gem_context;
	struct i915_timeline *timeline = rq->timeline;


	lockdep_assert_held(&engine->timeline.lock);
	lockdep_assert_held(&engine->timeline.lock);
	GEM_BUG_ON(timeline == &engine->timeline);


	spin_lock(&timeline->lock);
	if (!i915_request_is_active(rq))
		return;


	if (i915_request_is_active(rq)) {
	list_for_each_entry_continue(rq, &engine->timeline.requests, link)
		list_for_each_entry_continue(rq,
					     &engine->timeline.requests, link)
		if (rq->gem_context == hung_ctx)
		if (rq->gem_context == hung_ctx)
			i915_request_skip(rq, -EIO);
			i915_request_skip(rq, -EIO);
}
}


	list_for_each_entry(rq, &timeline->requests, link)
		i915_request_skip(rq, -EIO);

	spin_unlock(&timeline->lock);
}

static void client_mark_guilty(struct drm_i915_file_private *file_priv,
static void client_mark_guilty(struct drm_i915_file_private *file_priv,
			       const struct i915_gem_context *ctx)
			       const struct i915_gem_context *ctx)
{
{