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 <ch...@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuopp...@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

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to