Commit 16c8619a authored by Chris Wilson's avatar Chris Wilson

drm/i915: Avoid context dereference inside execlists_submission_tasklet

A lesson that has to be relearnt over and over again is that the request
does not keep a reference to the context and so we cannot freely
dereference the context from inside the execlists_submission_tasklet. In
particular, we try to do so in the new GEM_TRACE() so convert those over
to the port->context_id we keep for GEM debugging. This means the
tracing now depends on DRM_I915_GEM_DEBUG.

Fixes: bccd3b83 ("drm/i915: Use trace_printk to provide a death rattle for GEM")
References: https://bugs.freedesktop.org/show_bug.cgi?id=104066
References: https://bugs.freedesktop.org/show_bug.cgi?id=104162
References: https://bugs.freedesktop.org/show_bug.cgi?id=104242
References: https://bugs.freedesktop.org/show_bug.cgi?id=104310Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: default avatarMichel Thierry <michel.thierry@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171219220916.30882-1-chris@chris-wilson.co.uk
parent 93dff100
...@@ -29,7 +29,6 @@ config DRM_I915_DEBUG ...@@ -29,7 +29,6 @@ config DRM_I915_DEBUG
select SW_SYNC # signaling validation framework (igt/syncobj*) select SW_SYNC # signaling validation framework (igt/syncobj*)
select DRM_I915_SW_FENCE_DEBUG_OBJECTS select DRM_I915_SW_FENCE_DEBUG_OBJECTS
select DRM_I915_SELFTEST select DRM_I915_SELFTEST
select DRM_I915_TRACE_GEM
default n default n
help help
Choose this option to turn on extra driver debugging that may affect Choose this option to turn on extra driver debugging that may affect
...@@ -53,6 +52,7 @@ config DRM_I915_DEBUG_GEM ...@@ -53,6 +52,7 @@ config DRM_I915_DEBUG_GEM
config DRM_I915_TRACE_GEM config DRM_I915_TRACE_GEM
bool "Insert extra ftrace output from the GEM internals" bool "Insert extra ftrace output from the GEM internals"
depends on DRM_I915_DEBUG_GEM
select TRACING select TRACING
default n default n
help help
......
...@@ -449,7 +449,7 @@ static void execlists_submit_ports(struct intel_engine_cs *engine) ...@@ -449,7 +449,7 @@ static void execlists_submit_ports(struct intel_engine_cs *engine)
GEM_TRACE("%s in[%d]: ctx=%d.%d, seqno=%x\n", GEM_TRACE("%s in[%d]: ctx=%d.%d, seqno=%x\n",
engine->name, n, engine->name, n,
rq->ctx->hw_id, count, port[n].context_id, count,
rq->global_seqno); rq->global_seqno);
} else { } else {
GEM_BUG_ON(!n); GEM_BUG_ON(!n);
...@@ -861,7 +861,7 @@ static void execlists_submission_tasklet(unsigned long data) ...@@ -861,7 +861,7 @@ static void execlists_submission_tasklet(unsigned long data)
*/ */
status = READ_ONCE(buf[2 * head]); /* maybe mmio! */ status = READ_ONCE(buf[2 * head]); /* maybe mmio! */
GEM_TRACE("%s csb[%dd]: status=0x%08x:0x%08x\n", GEM_TRACE("%s csb[%d]: status=0x%08x:0x%08x\n",
engine->name, head, engine->name, head,
status, buf[2*head + 1]); status, buf[2*head + 1]);
...@@ -905,7 +905,7 @@ static void execlists_submission_tasklet(unsigned long data) ...@@ -905,7 +905,7 @@ static void execlists_submission_tasklet(unsigned long data)
rq = port_unpack(port, &count); rq = port_unpack(port, &count);
GEM_TRACE("%s out[0]: ctx=%d.%d, seqno=%x\n", GEM_TRACE("%s out[0]: ctx=%d.%d, seqno=%x\n",
engine->name, engine->name,
rq->ctx->hw_id, count, port->context_id, count,
rq->global_seqno); rq->global_seqno);
GEM_BUG_ON(count == 0); GEM_BUG_ON(count == 0);
if (--count == 0) { if (--count == 0) {
......
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