]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/i915: Drop struct_mutex from around GEM initialisation
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 4 Oct 2019 13:40:15 +0000 (14:40 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 4 Oct 2019 14:39:43 +0000 (15:39 +0100)
We no longer need to placate lockdep by holding struct_mutex for our
initialisation, so don't.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191004134015.13204-21-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/gem/i915_gem_pm.c
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/selftests/mock_gem_device.c

index 7c316d4633db80b77e79a890e05054db94bcc9f9..7987b54fb1f5112ed807879d8c86ad83432b4e6a 100644 (file)
@@ -174,7 +174,6 @@ void i915_gem_resume(struct drm_i915_private *i915)
 {
        GEM_TRACE("\n");
 
-       mutex_lock(&i915->drm.struct_mutex);
        intel_uncore_forcewake_get(&i915->uncore, FORCEWAKE_ALL);
 
        if (intel_gt_init_hw(&i915->gt))
@@ -198,7 +197,6 @@ void i915_gem_resume(struct drm_i915_private *i915)
 
 out_unlock:
        intel_uncore_forcewake_put(&i915->uncore, FORCEWAKE_ALL);
-       mutex_unlock(&i915->drm.struct_mutex);
        return;
 
 err_wedged:
index b6d279987b713e95a74da799b5031b5abab28f8d..80f3153c48dcd4ba1956a3348c1c7f3c49e6f19a 100644 (file)
@@ -1249,7 +1249,6 @@ int i915_gem_init(struct drm_i915_private *dev_priv)
         * we hold the forcewake during initialisation these problems
         * just magically go away.
         */
-       mutex_lock(&dev_priv->drm.struct_mutex);
        intel_uncore_forcewake_get(&dev_priv->uncore, FORCEWAKE_ALL);
 
        ret = i915_init_ggtt(dev_priv);
@@ -1319,7 +1318,6 @@ int i915_gem_init(struct drm_i915_private *dev_priv)
                goto err_gt;
 
        intel_uncore_forcewake_put(&dev_priv->uncore, FORCEWAKE_ALL);
-       mutex_unlock(&dev_priv->drm.struct_mutex);
 
        return 0;
 
@@ -1330,15 +1328,11 @@ int i915_gem_init(struct drm_i915_private *dev_priv)
         * driver doesn't explode during runtime.
         */
 err_gt:
-       mutex_unlock(&dev_priv->drm.struct_mutex);
-
        intel_gt_set_wedged_on_init(&dev_priv->gt);
        i915_gem_suspend(dev_priv);
        i915_gem_suspend_late(dev_priv);
 
        i915_gem_drain_workqueue(dev_priv);
-
-       mutex_lock(&dev_priv->drm.struct_mutex);
 err_init_hw:
        intel_uc_fini_hw(&dev_priv->gt.uc);
 err_uc_init:
@@ -1353,7 +1347,6 @@ err_scratch:
        intel_gt_driver_release(&dev_priv->gt);
 err_unlock:
        intel_uncore_forcewake_put(&dev_priv->uncore, FORCEWAKE_ALL);
-       mutex_unlock(&dev_priv->drm.struct_mutex);
 
        if (ret != -EIO) {
                intel_uc_cleanup_firmwares(&dev_priv->gt.uc);
@@ -1406,10 +1399,8 @@ void i915_gem_driver_remove(struct drm_i915_private *dev_priv)
        /* Flush any outstanding unpin_work. */
        i915_gem_drain_workqueue(dev_priv);
 
-       mutex_lock(&dev_priv->drm.struct_mutex);
        intel_uc_fini_hw(&dev_priv->gt.uc);
        intel_uc_fini(&dev_priv->gt.uc);
-       mutex_unlock(&dev_priv->drm.struct_mutex);
 
        i915_gem_drain_freed_objects(dev_priv);
 }
index 335f37ba98dec209567783778bf9dfb1da3dc4f8..70a7026db08dd281015680bf067c31cbc7c21dc0 100644 (file)
@@ -68,10 +68,7 @@ static void mock_device_release(struct drm_device *dev)
        drain_workqueue(i915->wq);
        i915_gem_drain_freed_objects(i915);
 
-       mutex_lock(&i915->drm.struct_mutex);
        mock_fini_ggtt(&i915->ggtt);
-       mutex_unlock(&i915->drm.struct_mutex);
-
        destroy_workqueue(i915->wq);
 
        i915_gemfs_fini(i915);
@@ -179,8 +176,6 @@ struct drm_i915_private *mock_gem_device(void)
 
        intel_timelines_init(i915);
 
-       mutex_lock(&i915->drm.struct_mutex);
-
        mock_init_ggtt(i915, &i915->ggtt);
 
        mkwrite_device_info(i915)->engine_mask = BIT(0);
@@ -197,7 +192,6 @@ struct drm_i915_private *mock_gem_device(void)
                goto err_context;
 
        intel_engines_driver_register(i915);
-       mutex_unlock(&i915->drm.struct_mutex);
 
        WARN_ON(i915_gemfs_init(i915));
 
@@ -208,7 +202,6 @@ err_context:
 err_engine:
        mock_engine_free(i915->engine[RCS0]);
 err_unlock:
-       mutex_unlock(&i915->drm.struct_mutex);
        intel_timelines_fini(i915);
        destroy_workqueue(i915->wq);
 err_drv: