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

Commit 546b1b6a authored by Chris Wilson's avatar Chris Wilson
Browse files

drm/i915: Store the active context object on all engines upon error



With execlists, we have context objects everywhere, not just RCS. So
store them for post-mortem debugging. This also has a secondary effect
of removing one more unsafe list iteration with using preserved state
from the hanging request. And now we can cross-reference the request's
context state with that loaded by the GPU.

Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1471254551-25805-3-git-send-email-chris@chris-wilson.co.uk
parent c0ce4663
Loading
Loading
Loading
Loading
+4 −24
Original line number Original line Diff line number Diff line
@@ -1043,28 +1043,6 @@ static void error_record_engine_registers(struct drm_i915_error_state *error,
	}
	}
}
}


static void i915_gem_record_active_context(struct intel_engine_cs *engine,
					   struct drm_i915_error_state *error,
					   struct drm_i915_error_engine *ee)
{
	struct drm_i915_private *dev_priv = engine->i915;
	struct drm_i915_gem_object *obj;

	/* Currently render ring is the only HW context user */
	if (engine->id != RCS || !error->ccid)
		return;

	list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list) {
		if (!i915_gem_obj_ggtt_bound(obj))
			continue;

		if ((error->ccid & PAGE_MASK) == i915_gem_obj_ggtt_offset(obj)) {
			ee->ctx = i915_error_ggtt_object_create(dev_priv, obj);
			break;
		}
	}
}

static void i915_gem_record_rings(struct drm_i915_private *dev_priv,
static void i915_gem_record_rings(struct drm_i915_private *dev_priv,
				  struct drm_i915_error_state *error)
				  struct drm_i915_error_state *error)
{
{
@@ -1114,6 +1092,10 @@ static void i915_gem_record_rings(struct drm_i915_private *dev_priv,
					i915_error_ggtt_object_create(dev_priv,
					i915_error_ggtt_object_create(dev_priv,
								      engine->scratch.obj);
								      engine->scratch.obj);


			ee->ctx =
				i915_error_ggtt_object_create(dev_priv,
							      request->ctx->engine[i].state);

			if (request->pid) {
			if (request->pid) {
				struct task_struct *task;
				struct task_struct *task;


@@ -1144,8 +1126,6 @@ static void i915_gem_record_rings(struct drm_i915_private *dev_priv,
		ee->wa_ctx = i915_error_ggtt_object_create(dev_priv,
		ee->wa_ctx = i915_error_ggtt_object_create(dev_priv,
							   engine->wa_ctx.obj);
							   engine->wa_ctx.obj);


		i915_gem_record_active_context(engine, error, ee);

		count = 0;
		count = 0;
		list_for_each_entry(request, &engine->request_list, link)
		list_for_each_entry(request, &engine->request_list, link)
			count++;
			count++;