diff mbox series

drm/vmwgfx: fix spinlock initialization in vmw_driver_load()

Message ID 20210321145649.2948-1-penguin-kernel@I-love.SAKURA.ne.jp (mailing list archive)
State New, archived
Headers show
Series drm/vmwgfx: fix spinlock initialization in vmw_driver_load() | expand

Commit Message

Tetsuo Handa March 21, 2021, 2:56 p.m. UTC
Since vmw_write() from vmw_detect_version() from vmw_driver_load() calls
spin_lock(&dev_priv->hw_lock), spin_lock_init(&dev_priv->hw_lock) has to
be called before vmw_detect_version() is called, or lockdep gets disabled.

  INFO: trying to register non-static key.
  the code is fine but needs lockdep annotation.
  turning off the locking correctness validator.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Fixes: 8772c0bb58bbf98a ("drm/vmwgfx: Cleanup pci resource allocation")
---
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Zack Rusin March 21, 2021, 7:16 p.m. UTC | #1
> On Mar 21, 2021, at 10:56, Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> wrote:
> 
> Since vmw_write() from vmw_detect_version() from vmw_driver_load() calls
> spin_lock(&dev_priv->hw_lock), spin_lock_init(&dev_priv->hw_lock) has to
> be called before vmw_detect_version() is called, or lockdep gets disabled.
> 
>  INFO: trying to register non-static key.
>  the code is fine but needs lockdep annotation.
>  turning off the locking correctness validator.
> 
> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> Fixes: 8772c0bb58bbf98a ("drm/vmwgfx: Cleanup pci resource allocation")

Thank you. I have a bit different version of this patch in my tree, I fixed it after Thomas noticed it last week but I was waiting for the pin/reserve discussion on the list to finish before pushing it. I apologize it took this long to get it upstreamed, I’ll get to it tomorrow. I’ll make sure to CC you on that series.

z
diff mbox series

Patch

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index dd69b51c40e4..a8049092fb32 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -715,6 +715,7 @@  static int vmw_driver_load(struct vmw_private *dev_priv, u32 pci_id)
 	ret = vmw_setup_pci_resources(dev_priv, pci_id);
 	if (ret)
 		return ret;
+	spin_lock_init(&dev_priv->hw_lock);
 	ret = vmw_detect_version(dev_priv);
 	if (ret)
 		goto out_no_pci_or_version;
@@ -725,7 +726,6 @@  static int vmw_driver_load(struct vmw_private *dev_priv, u32 pci_id)
 	mutex_init(&dev_priv->global_kms_state_mutex);
 	ttm_lock_init(&dev_priv->reservation_sem);
 	spin_lock_init(&dev_priv->resource_lock);
-	spin_lock_init(&dev_priv->hw_lock);
 	spin_lock_init(&dev_priv->waiter_lock);
 	spin_lock_init(&dev_priv->cap_lock);
 	spin_lock_init(&dev_priv->cursor_lock);