From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: thomas.hellstrom@linux.intel.com, dakr@kernel.org,
ecourtney@nvidia.com, matthew.brost@intel.com,
nat@pixelcluster.dev, dri-devel@lists.freedesktop.org,
intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
amd-gfx@lists.freedesktop.org
Subject: [PATCH 07/11] drm/xe: Use dma_resv_alloc for lockdep annotation
Date: Thu, 3 Sep 2026 15:28:02 +0200 [thread overview]
Message-ID: <20260903134408.105317-8-christian.koenig@amd.com> (raw)
In-Reply-To: <20260903134408.105317-1-christian.koenig@amd.com>
Replace the stack-allocated dma_resv in xe_pm_runtime_lockdep_prime()
with a dynamically allocated one using dma_resv_alloc(). This aligns
with the move away from embedded dma_resv structures and towards
reference-counted dynamic allocation.
The lockdep priming function is used to establish lock ordering
dependencies between runtime PM and dma_resv locks. The resv is only
used temporarily for lockdep annotation and is immediately freed after
use with dma_resv_put().
If allocation fails, we silently return since this is optional lockdep
annotation that only affects dependency checking, not functional
behavior.
Signed-off-by: Christian König <christian.koenig@amd.com>
Assisted-by: Claude:Sonnet 4
---
drivers/gpu/drm/xe/xe_pm.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_pm.c b/drivers/gpu/drm/xe/xe_pm.c
index 99562f691080..33b19bcb6f71 100644
--- a/drivers/gpu/drm/xe/xe_pm.c
+++ b/drivers/gpu/drm/xe/xe_pm.c
@@ -762,15 +762,20 @@ static void xe_rpm_might_enter_cb(const struct xe_device *xe)
*/
static void xe_pm_runtime_lockdep_prime(void)
{
- struct dma_resv lockdep_resv;
+ struct dma_resv *lockdep_resv;
+
+ lockdep_resv = dma_resv_alloc();
+ if (!lockdep_resv)
+ return;
- dma_resv_init(&lockdep_resv);
lock_map_acquire(&xe_pm_runtime_d3cold_map);
/* D3Cold takes the dma_resv locks to evict bos */
- dma_resv_lock(&lockdep_resv, NULL);
- dma_resv_unlock(&lockdep_resv);
+ dma_resv_lock(lockdep_resv, NULL);
+ dma_resv_unlock(lockdep_resv);
lock_map_release(&xe_pm_runtime_d3cold_map);
+ dma_resv_put(lockdep_resv);
+
/* Shrinkers might like to wake up the device under reclaim. */
fs_reclaim_acquire(GFP_KERNEL);
lock_map_acquire(&xe_pm_runtime_nod3cold_map);
--
2.43.0
next prev parent reply other threads:[~2026-09-03 13:44 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 13:27 Refcounting dma_resv v3 Christian König
2026-09-03 13:27 ` [PATCH 01/11] drm/i915: fix incorrect RCU teardown order Christian König
2026-09-03 13:27 ` [PATCH 02/11] dma-buf: Add reference counting to dma_resv v2 Christian König
2026-09-03 13:27 ` [PATCH 03/11] dma-buf/tests: Convert st-dma-resv tests to use dma_resv_alloc v2 Christian König
2026-09-03 13:27 ` [PATCH 04/11] drm/gem: Add helper for drm_gem_object resv assignment v2 Christian König
2026-09-03 13:28 ` [PATCH 05/11] drm/gem: Convert drm_gem_private_object_init to return error code v2 Christian König
2026-09-03 13:28 ` [PATCH 06/11] drm/mode_config: Use dma_resv_alloc for lockdep annotation Christian König
2026-09-03 13:28 ` Christian König [this message]
2026-09-10 2:22 ` [PATCH 07/11] drm/xe: " Matthew Brost
2026-09-03 13:28 ` [PATCH 08/11] drm/i915/gt: Use dma_resv_alloc for VM reservation objects v2 Christian König
2026-09-03 13:28 ` [PATCH 09/11] drm/ttm/tests: Use dma_resv_alloc in test files Christian König
2026-09-03 13:28 ` [PATCH 10/11] drm/gem: Use dynamic allocation for GEM object dma_resv Christian König
2026-09-10 3:02 ` Matthew Brost
2026-09-03 13:28 ` [PATCH 11/11] dma-buf: Inline dma_resv_init and remove allocated flag Christian König
2026-09-10 3:23 ` Matthew Brost
2026-09-03 15:10 ` ✗ Fi.CI.BUILD: failure for series starting with [01/11] drm/i915: fix incorrect RCU teardown order Patchwork
2026-09-03 19:38 ` Refcounting dma_resv v3 Matthew Brost
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=20260903134408.105317-8-christian.koenig@amd.com \
--to=ckoenig.leichtzumerken@gmail.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=ecourtney@nvidia.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.brost@intel.com \
--cc=nat@pixelcluster.dev \
--cc=thomas.hellstrom@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.