drm/i915/gvt: To check whether workload scan and shadow has mutex hold
authorPing Gao <ping.a.gao@intel.com>
Tue, 4 Jul 2017 06:53:03 +0000 (14:53 +0800)
committerZhenyu Wang <zhenyuw@linux.intel.com>
Thu, 10 Aug 2017 02:26:07 +0000 (10:26 +0800)
The function workload scan and shadow have to hold the drm.struct_mutex
before called. To avoid misusing of this function, add a lockdep assert
in it.

Signed-off-by: Ping Gao <ping.a.gao@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
drivers/gpu/drm/i915/gvt/scheduler.c

index bd59c6d093191ba9140a510342dedf9da47be8d9..ca1926d564c9a47e79f7549921f38f30f41036fa 100644 (file)
@@ -201,6 +201,8 @@ int intel_gvt_scan_and_shadow_workload(struct intel_vgpu_workload *workload)
        struct intel_vgpu *vgpu = workload->vgpu;
        int ret;
 
+       lockdep_assert_held(&dev_priv->drm.struct_mutex);
+
        if (workload->shadowed)
                return 0;