mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] amdgpu: lockdep: move temporary mutexes off stack
@ 2026-06-11 13:02 Arnd Bergmann
  2026-06-11 15:14 ` Christian König
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2026-06-11 13:02 UTC (permalink / raw)
  To: Alex Deucher, Christian König, David Airlie, Simona Vetter,
	Vitaly Prosyak
  Cc: Arnd Bergmann, amd-gfx, dri-devel, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

In randconfig builds, the newly added function frequently exceeds
the limit for stack frames, like:

drivers/gpu/drm/amd/amdgpu/amdgpu_lockdep.c:84:5: error: stack frame size (1312) exceeds limit (1280) in 'amdgpu_lockdep_init' [-Werror,-Wframe-larger-than]

Change this to use static allocation for the locks to reduce
this at the expense of a slightly larger driver binary.

Fixes: 1d0f5838b126 ("drm/amdgpu: Add lockdep annotations for lock ordering validation")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_lockdep.c | 24 ++++++---------------
 1 file changed, 7 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_lockdep.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_lockdep.c
index d5d71fd7c70d..cf723c9f9216 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_lockdep.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_lockdep.c
@@ -85,13 +85,13 @@ int amdgpu_lockdep_init(void)
 {
 	struct amdgpu_reset_domain *reset_domain = NULL;
 	struct amdgpu_reset_control reset_ctl;
-	struct mutex userq_sch_mutex;
-	struct mutex userq_mutex;
-	struct mutex notifier_lock;
-	struct mutex vram_lock;
-	struct mutex srbm_mutex;
-	struct mutex grbm_idx_mutex;
-	spinlock_t mmio_idx_lock;
+	static DEFINE_MUTEX(userq_sch_mutex);
+	static DEFINE_MUTEX(userq_mutex);
+	static DEFINE_MUTEX(notifier_lock);
+	static DEFINE_MUTEX(vram_lock);
+	static DEFINE_MUTEX(srbm_mutex);
+	static DEFINE_MUTEX(grbm_idx_mutex);
+	static DEFINE_SPINLOCK(mmio_idx_lock);
 	unsigned long flags;
 
 	/*
@@ -102,16 +102,6 @@ int amdgpu_lockdep_init(void)
 	if (!reset_domain)
 		return -ENOMEM;
 
-	/* Initialize dummy locks */
-	mutex_init(&userq_sch_mutex);
-	mutex_init(&userq_mutex);
-	mutex_init(&notifier_lock);
-	mutex_init(&vram_lock);
-	mutex_init(&reset_ctl.reset_lock);
-	mutex_init(&srbm_mutex);
-	mutex_init(&grbm_idx_mutex);
-	spin_lock_init(&mmio_idx_lock);
-
 	/*
 	 * Associate dummy locks with the same class keys used for real
 	 * driver locks. This ensures lockdep connects the ordering learned
-- 
2.39.5


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

end of thread, other threads:[~2026-06-11 15:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-11 13:02 [PATCH] amdgpu: lockdep: move temporary mutexes off stack Arnd Bergmann
2026-06-11 15:14 ` Christian König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®