dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/vmwgfx: fix spinlock initialization in vmw_driver_load()
@ 2021-03-21 14:56 Tetsuo Handa
  2021-03-21 19:16 ` Zack Rusin
  0 siblings, 1 reply; 2+ messages in thread
From: Tetsuo Handa @ 2021-03-21 14:56 UTC (permalink / raw)
  To: Zack Rusin, Martin Krastev, Roland Scheidegger; +Cc: Tetsuo Handa, dri-devel

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(-)

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);
-- 
2.18.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/vmwgfx: fix spinlock initialization in vmw_driver_load()
  2021-03-21 14:56 [PATCH] drm/vmwgfx: fix spinlock initialization in vmw_driver_load() Tetsuo Handa
@ 2021-03-21 19:16 ` Zack Rusin
  0 siblings, 0 replies; 2+ messages in thread
From: Zack Rusin @ 2021-03-21 19:16 UTC (permalink / raw)
  To: Tetsuo Handa; +Cc: Martin Krastev, Roland Scheidegger, dri-devel



> 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

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-21 19:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-21 14:56 [PATCH] drm/vmwgfx: fix spinlock initialization in vmw_driver_load() Tetsuo Handa
2021-03-21 19:16 ` Zack Rusin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).