[PATCH 2/9] drm/i915: Assert that the context-switch completion matches our context

Chris Wilson chris at chris-wilson.co.uk
Sat Jan 21 18:28:31 UTC 2017


When execlists signals the context completion, it also provides the
context id for the status event. Assert that id matches the one we expect.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_lrc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index 432ee495dec2..1fb6502f500f 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -595,6 +595,14 @@ static void intel_lrc_irq_handler(unsigned long data)
 			if (!(status & GEN8_CTX_STATUS_COMPLETED_MASK))
 				continue;
 
+			/* Check the context id for this event matches */
+			if (readl(buf + 2 * idx + 1) != port[0].request->ctx->hw_id) {
+				printk(KERN_ERR "context-switch status completed mismatch expected id %x, found %x, status %x, port[0].count=%d\n",
+				       port[0].request->ctx->hw_id,
+				       readl(buf + 2 * idx + 1),
+				       status, port[0].count);
+			}
+
 			GEM_BUG_ON(port[0].count == 0);
 			if (--port[0].count == 0) {
 				GEM_BUG_ON(status & GEN8_CTX_STATUS_PREEMPTED);
-- 
2.11.0



More information about the Intel-gfx-trybot mailing list