drm/i915/gvt: fix the usage of ww lock in gvt scheduler.
authorZhi A Wang <zhi.wang.linux2@gmail.com>
Thu, 26 Aug 2021 14:38:34 +0000 (14:38 +0000)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Mon, 1 Nov 2021 20:38:12 +0000 (16:38 -0400)
As the APIs related to ww lock in i915 was changed recently, the usage of
ww lock in GVT-g scheduler needs to be changed accrodingly. We noticed a
deadlock when GVT-g scheduler submits the workload to i915. After some
investigation, it seems the way of how to use ww lock APIs has been
changed. Releasing a ww now requires a explicit i915_gem_ww_ctx_fini().

Fixes: 67f1120381df ("drm/i915/gvt: Introduce per object locking in GVT scheduler.")
Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Zhi A Wang <zhi.a.wang@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20210826143834.25410-1-zhi.a.wang@intel.com
Acked-by: Zhenyu Wang <zhenyuw@linux.intel.com>
(cherry picked from commit d168cd797982db9db617113644c87b8f5f3cf27e)
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/i915/gvt/scheduler.c

index 0d18e13e34686ddc6d9c19b8284fb69827a9b58e..6c804102528b1760f9cbe57b5a72e3e6e99d443f 100644 (file)
@@ -576,7 +576,7 @@ retry:
 
                        /* No one is going to touch shadow bb from now on. */
                        i915_gem_object_flush_map(bb->obj);
-                       i915_gem_object_unlock(bb->obj);
+                       i915_gem_ww_ctx_fini(&ww);
                }
        }
        return 0;
@@ -630,7 +630,7 @@ retry:
                return ret;
        }
 
-       i915_gem_object_unlock(wa_ctx->indirect_ctx.obj);
+       i915_gem_ww_ctx_fini(&ww);
 
        /* FIXME: we are not tracking our pinned VMA leaving it
         * up to the core to fix up the stray pin_count upon