[AMD Official Use Only - AMD Internal Distribution Only]

> -----Original Message-----
> From: Koenig, Christian <[email protected]>
> Sent: Friday, December 5, 2025 6:30 PM
> To: SHANMUGAM, SRINIVASAN <[email protected]>;
> Deucher, Alexander <[email protected]>
> Cc: [email protected]
> Subject: Re: [PATCH] drm/amdgpu: Reduce stack usage in
> amdgpu_userq_wait_ioctl()
>
> On 12/5/25 13:14, Srinivasan Shanmugam wrote:
> > Checked all the local variables in the function. Most of them are
> > small numbers or pointers and use very little stack space. The only
> > large item stored on the stack is struct drm_exec, and this is what
> > pushes the stack size over the limit.
> >
> > To fix this, struct drm_exec is now allocated with kmalloc() instead
> > of being placed on the stack. All call sites were updated to use a
> > pointer, and all cleanup paths now call drm_exec_fini() and kfree() to
> > release the memory safely.
> >
> > This reduces stack usage, fixes the below:
> > drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c:642:5: warning: stack
> > frame size (1176) exceeds limit (1024) in 'amdgpu_userq_wait_ioctl'
> > [-Wframe-larger-than]
>
> Mhm, I'm really wondering how that happens? The drm_exec object is 
> intentionally
> so small that it can be allocated on the stack.
>
> What's going on here?

Hi Christian,

It looks like it only grows that large with sanitizers enabled — KASAN/UBSAN 
inflate the frame, not drm_exec itself.

Thanks!
Srini

Reply via email to