AMD General > -----Original Message----- > From: Alex Deucher <[email protected]> > Sent: Friday, June 19, 2026 11:47 PM > To: SHANMUGAM, SRINIVASAN <[email protected]> > Cc: Koenig, Christian <[email protected]>; Deucher, Alexander > <[email protected]>; [email protected]; Timur Kristóf > <[email protected]> > Subject: Re: [PATCH] drm/amdgpu: Reduce stack usage in IP block soft reset > > On Fri, Jun 19, 2026 at 1:54 PM Srinivasan Shanmugam > <[email protected]> wrote: > > > > amdgpu_device_ip_soft_reset() allocates an array of AMDGPU_MAX_RINGS > > ring pointers on the stack. On 64-bit builds this consumes around 1280 > > bytes and triggers: > > > > warning: stack frame size (1304) exceeds limit (1024) > > > > Move the temporary ring pointer array to heap allocation to reduce > > stack usage. > > > > Fixes: a6319ac34a13 ("drm/amdgpu: Add IP block soft reset as a GPU > > recovery method") > > Cc: Alex Deucher <[email protected]> > > Cc: Timur Kristóf <[email protected]> > > Signed-off-by: Srinivasan Shanmugam <[email protected]> > > --- > > drivers/gpu/drm/amd/amdgpu/amdgpu_ip.c | 19 ++++++++++++++----- > > 1 file changed, 14 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ip.c > > b/drivers/gpu/drm/amd/amdgpu/amdgpu_ip.c > > index 65505bc50399..eeb9383b1010 100644 > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ip.c > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ip.c > > @@ -524,7 +524,7 @@ int amdgpu_device_ip_soft_reset(struct amdgpu_ring > *guilty_ring, > > struct amdgpu_fence *guilty_fence) { > > struct amdgpu_device *adev = guilty_ring->adev; > > - struct amdgpu_ring *rings[AMDGPU_MAX_RINGS]; > > + struct amdgpu_ring **rings; > > struct amdgpu_ip_block *ip_block; > > enum amd_ip_block_type ip_type; > > u32 num_rings, ring_type_mask; @@ -539,6 +539,10 @@ int > > amdgpu_device_ip_soft_reset(struct amdgpu_ring *guilty_ring, > > return -EOPNOTSUPP; > > } > > > > + rings = kcalloc(AMDGPU_MAX_RINGS, sizeof(*rings), GFP_KERNEL); > > We can't allocate memory in the reset path otherwise we could deadlock, this > needs > to be pre-allocated if you use the heap.
Thanks Alex. I'll avoid allocation in the reset path and respin this by using a preallocated per-device scratch ring array instead. Best regards, Srini > > Alex
