On Thu, Sep 03, 2026 at 03:28:02PM +0200, Christian König wrote: > 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 <[email protected]>
Reviewed-by: Matthew Brost <[email protected]> > 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 >
