Take the ww lock around engine_unpark. Because of the
many many places where rpm is used, I chose the safest option
and used a trylock to opportunistically take this lock for
__engine_unpark.

Signed-off-by: Maarten Lankhorst <[email protected]>
---
 drivers/gpu/drm/i915/gt/intel_engine_pm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_engine_pm.c 
b/drivers/gpu/drm/i915/gt/intel_engine_pm.c
index f7b2e07e2229..1ab9597a5c70 100644
--- a/drivers/gpu/drm/i915/gt/intel_engine_pm.c
+++ b/drivers/gpu/drm/i915/gt/intel_engine_pm.c
@@ -33,7 +33,8 @@ static int __engine_unpark(struct intel_wakeref *wf)
                GEM_BUG_ON(test_bit(CONTEXT_VALID_BIT, &ce->flags));
 
                /* First poison the image to verify we never fully trust it */
-               if (IS_ENABLED(CONFIG_DRM_I915_DEBUG_GEM) && ce->state) {
+               if (IS_ENABLED(CONFIG_DRM_I915_DEBUG_GEM) && ce->state &&
+                   i915_gem_object_trylock(ce->state->obj)) {
                        struct drm_i915_gem_object *obj = ce->state->obj;
                        int type = i915_coherent_map_type(engine->i915);
                        void *map;
@@ -44,6 +45,7 @@ static int __engine_unpark(struct intel_wakeref *wf)
                                i915_gem_object_flush_map(obj);
                                i915_gem_object_unpin_map(obj);
                        }
+                       i915_gem_object_unlock(obj);
                }
 
                ce->ops->reset(ce);
-- 
2.28.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to