[Intel-gfx] [PATCH] drm/i915: Keep engine alive as we retire the context

Chris Wilson chris at chris-wilson.co.uk
Mon Jun 17 08:40:44 UTC 2019


Though we pin the context first before taking the pm wakeref, during
retire we need to unpin before dropping the pm wakeref (breaking the
"natural" onion). During the unpin, we may need to attach a cleanup
operation on to the engine wakeref, ergo we want to keep the engine
awake until after the unpin.

Fixes: ce476c80b8bf ("drm/i915: Keep contexts pinned until after the next kernel context switch")
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala at linux.intel.com>
---
 drivers/gpu/drm/i915/i915_request.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_request.c b/drivers/gpu/drm/i915/i915_request.c
index 9819483d1b5d..8d952bc03d5c 100644
--- a/drivers/gpu/drm/i915/i915_request.c
+++ b/drivers/gpu/drm/i915/i915_request.c
@@ -250,8 +250,9 @@ static bool i915_request_retire(struct i915_request *rq)
 
 	local_irq_enable();
 
-	intel_context_exit(rq->hw_context);
+	/* Onion reversed to keep engine alive until after unpinning */
 	intel_context_unpin(rq->hw_context);
+	intel_context_exit(rq->hw_context);
 
 	i915_request_remove_from_client(rq);
 	list_del(&rq->link);
-- 
2.20.1



More information about the Intel-gfx mailing list