From: Arnd Bergmann <arnd@kernel.org>
To: "Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Vitaly Prosyak" <vitaly.prosyak@amd.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] amdgpu: lockdep: move temporary mutexes off stack
Date: Thu, 11 Jun 2026 15:02:33 +0200 [thread overview]
Message-ID: <20260611130240.3388318-1-arnd@kernel.org> (raw)
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(¬ifier_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
next reply other threads:[~2026-06-11 13:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-11 13:02 Arnd Bergmann [this message]
2026-06-11 15:14 ` Christian König
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260611130240.3388318-1-arnd@kernel.org \
--to=arnd@kernel.org \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=arnd@arndb.de \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=simona@ffwll.ch \
--cc=vitaly.prosyak@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®