All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: Reduce stack usage in IP block soft reset
@ 2026-06-19 17:17 Srinivasan Shanmugam
  2026-06-19 18:17 ` Alex Deucher
  2026-06-22  8:15 ` Christian König
  0 siblings, 2 replies; 9+ messages in thread
From: Srinivasan Shanmugam @ 2026-06-19 17:17 UTC (permalink / raw)
  To: Christian König, Alex Deucher
  Cc: amd-gfx, Srinivasan Shanmugam, Timur Kristóf

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 <alexander.deucher@amd.com>
Cc: Timur Kristóf <timur.kristof@gmail.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
---
 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);
+	if (!rings)
+		return -ENOMEM;
+
 	dev_err(adev->dev, "Starting %s IP block soft reset\n",
 		ip_block->version->funcs->name);
 
@@ -546,20 +550,25 @@ int amdgpu_device_ip_soft_reset(struct amdgpu_ring *guilty_ring,
 	amdgpu_filter_rings(adev, ring_type_mask, rings, &num_rings);
 
 	amdgpu_device_lock_reset_domain(adev->reset_domain);
-	amdgpu_multi_ring_reset_helper_begin(rings, num_rings, guilty_ring, guilty_fence);
+	amdgpu_multi_ring_reset_helper_begin(rings, num_rings, guilty_ring,
+					     guilty_fence);
 
 	r = ip_block->version->funcs->soft_reset(ip_block);
 
-	r = amdgpu_multi_ring_reset_helper_end(rings, num_rings, guilty_ring, r);
+	r = amdgpu_multi_ring_reset_helper_end(rings, num_rings, guilty_ring,
+					       r);
 	amdgpu_device_unlock_reset_domain(adev->reset_domain);
 
 	if (r) {
 		dev_err(adev->dev, "Failed %s IP block soft reset: %d\n",
 			ip_block->version->funcs->name, r);
-		return r;
+		goto out_free;
 	}
 
 	dev_err(adev->dev, "Successful %s IP block soft reset\n",
 		ip_block->version->funcs->name);
-	return 0;
+
+out_free:
+	kfree(rings);
+	return r;
 }
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] drm/amdgpu: Reduce stack usage in IP block soft reset
  2026-06-19 17:17 [PATCH] drm/amdgpu: Reduce stack usage in IP block soft reset Srinivasan Shanmugam
@ 2026-06-19 18:17 ` Alex Deucher
  2026-06-20  1:17   ` SHANMUGAM, SRINIVASAN
  2026-06-22  8:15 ` Christian König
  1 sibling, 1 reply; 9+ messages in thread
From: Alex Deucher @ 2026-06-19 18:17 UTC (permalink / raw)
  To: Srinivasan Shanmugam
  Cc: Christian König, Alex Deucher, amd-gfx, Timur Kristóf

On Fri, Jun 19, 2026 at 1:54 PM Srinivasan Shanmugam
<srinivasan.shanmugam@amd.com> 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 <alexander.deucher@amd.com>
> Cc: Timur Kristóf <timur.kristof@gmail.com>
> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
> ---
>  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.

Alex

> +       if (!rings)
> +               return -ENOMEM;
> +
>         dev_err(adev->dev, "Starting %s IP block soft reset\n",
>                 ip_block->version->funcs->name);
>
> @@ -546,20 +550,25 @@ int amdgpu_device_ip_soft_reset(struct amdgpu_ring *guilty_ring,
>         amdgpu_filter_rings(adev, ring_type_mask, rings, &num_rings);
>
>         amdgpu_device_lock_reset_domain(adev->reset_domain);
> -       amdgpu_multi_ring_reset_helper_begin(rings, num_rings, guilty_ring, guilty_fence);
> +       amdgpu_multi_ring_reset_helper_begin(rings, num_rings, guilty_ring,
> +                                            guilty_fence);
>
>         r = ip_block->version->funcs->soft_reset(ip_block);
>
> -       r = amdgpu_multi_ring_reset_helper_end(rings, num_rings, guilty_ring, r);
> +       r = amdgpu_multi_ring_reset_helper_end(rings, num_rings, guilty_ring,
> +                                              r);
>         amdgpu_device_unlock_reset_domain(adev->reset_domain);
>
>         if (r) {
>                 dev_err(adev->dev, "Failed %s IP block soft reset: %d\n",
>                         ip_block->version->funcs->name, r);
> -               return r;
> +               goto out_free;
>         }
>
>         dev_err(adev->dev, "Successful %s IP block soft reset\n",
>                 ip_block->version->funcs->name);
> -       return 0;
> +
> +out_free:
> +       kfree(rings);
> +       return r;
>  }
> --
> 2.34.1
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH] drm/amdgpu: Reduce stack usage in IP block soft reset
  2026-06-19 18:17 ` Alex Deucher
@ 2026-06-20  1:17   ` SHANMUGAM, SRINIVASAN
  0 siblings, 0 replies; 9+ messages in thread
From: SHANMUGAM, SRINIVASAN @ 2026-06-20  1:17 UTC (permalink / raw)
  To: Alex Deucher
  Cc: Koenig, Christian, Deucher, Alexander,
	amd-gfx@lists.freedesktop.org, Timur Kristóf

AMD General

> -----Original Message-----
> From: Alex Deucher <alexdeucher@gmail.com>
> Sent: Friday, June 19, 2026 11:47 PM
> To: SHANMUGAM, SRINIVASAN <SRINIVASAN.SHANMUGAM@amd.com>
> Cc: Koenig, Christian <Christian.Koenig@amd.com>; Deucher, Alexander
> <Alexander.Deucher@amd.com>; amd-gfx@lists.freedesktop.org; Timur Kristóf
> <timur.kristof@gmail.com>
> Subject: Re: [PATCH] drm/amdgpu: Reduce stack usage in IP block soft reset
>
> On Fri, Jun 19, 2026 at 1:54 PM Srinivasan Shanmugam
> <srinivasan.shanmugam@amd.com> 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 <alexander.deucher@amd.com>
> > Cc: Timur Kristóf <timur.kristof@gmail.com>
> > Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
> > ---
> >  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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] drm/amdgpu: Reduce stack usage in IP block soft reset
  2026-06-19 17:17 [PATCH] drm/amdgpu: Reduce stack usage in IP block soft reset Srinivasan Shanmugam
  2026-06-19 18:17 ` Alex Deucher
@ 2026-06-22  8:15 ` Christian König
  2026-06-22  9:01   ` SHANMUGAM, SRINIVASAN
  1 sibling, 1 reply; 9+ messages in thread
From: Christian König @ 2026-06-22  8:15 UTC (permalink / raw)
  To: Srinivasan Shanmugam, Alex Deucher; +Cc: amd-gfx, Timur Kristóf



On 6/19/26 19:17, Srinivasan Shanmugam 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.

Clear NAK.

GFP_KERNEL allocations are forbidden in the reset path.

You could use GFP_NOWAIT or GFP_ATOMIC, but that should be avoided as well.

Why is that array necessary in the first place?

Regards,
Christian.

> 
> Fixes: a6319ac34a13 ("drm/amdgpu: Add IP block soft reset as a GPU recovery method")
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Timur Kristóf <timur.kristof@gmail.com>
> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
> ---
>  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);
> +	if (!rings)
> +		return -ENOMEM;
> +
>  	dev_err(adev->dev, "Starting %s IP block soft reset\n",
>  		ip_block->version->funcs->name);
>  
> @@ -546,20 +550,25 @@ int amdgpu_device_ip_soft_reset(struct amdgpu_ring *guilty_ring,
>  	amdgpu_filter_rings(adev, ring_type_mask, rings, &num_rings);
>  
>  	amdgpu_device_lock_reset_domain(adev->reset_domain);
> -	amdgpu_multi_ring_reset_helper_begin(rings, num_rings, guilty_ring, guilty_fence);
> +	amdgpu_multi_ring_reset_helper_begin(rings, num_rings, guilty_ring,
> +					     guilty_fence);
>  
>  	r = ip_block->version->funcs->soft_reset(ip_block);
>  
> -	r = amdgpu_multi_ring_reset_helper_end(rings, num_rings, guilty_ring, r);
> +	r = amdgpu_multi_ring_reset_helper_end(rings, num_rings, guilty_ring,
> +					       r);
>  	amdgpu_device_unlock_reset_domain(adev->reset_domain);
>  
>  	if (r) {
>  		dev_err(adev->dev, "Failed %s IP block soft reset: %d\n",
>  			ip_block->version->funcs->name, r);
> -		return r;
> +		goto out_free;
>  	}
>  
>  	dev_err(adev->dev, "Successful %s IP block soft reset\n",
>  		ip_block->version->funcs->name);
> -	return 0;
> +
> +out_free:
> +	kfree(rings);
> +	return r;
>  }


^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH] drm/amdgpu: Reduce stack usage in IP block soft reset
  2026-06-22  8:15 ` Christian König
@ 2026-06-22  9:01   ` SHANMUGAM, SRINIVASAN
  2026-06-22  9:10     ` SHANMUGAM, SRINIVASAN
  0 siblings, 1 reply; 9+ messages in thread
From: SHANMUGAM, SRINIVASAN @ 2026-06-22  9:01 UTC (permalink / raw)
  To: Koenig, Christian, Deucher, Alexander
  Cc: amd-gfx@lists.freedesktop.org, Timur Kristóf

AMD General

> -----Original Message-----
> From: Koenig, Christian <Christian.Koenig@amd.com>
> Sent: Monday, June 22, 2026 1:45 PM
> To: SHANMUGAM, SRINIVASAN <SRINIVASAN.SHANMUGAM@amd.com>;
> Deucher, Alexander <Alexander.Deucher@amd.com>
> Cc: amd-gfx@lists.freedesktop.org; Timur Kristóf <timur.kristof@gmail.com>
> Subject: Re: [PATCH] drm/amdgpu: Reduce stack usage in IP block soft reset
>
>
>
> On 6/19/26 19:17, Srinivasan Shanmugam 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.
>
> Clear NAK.
>
> GFP_KERNEL allocations are forbidden in the reset path.
>
> You could use GFP_NOWAIT or GFP_ATOMIC, but that should be avoided as well.
>
> Why is that array necessary in the first place?


Thanks Christian.

Looks like the temporary array is currently only used to collect the subset of
rings affected by the IP block soft reset and pass them to
amdgpu_multi_ring_reset_helper_begin() and
amdgpu_multi_ring_reset_helper_end().

amdgpu_filter_rings() simply copies matching entries from
adev->rings[] into a temporary array, and that array is only
iterated over by the multi-ring reset helpers.

Looking at the implementation again, it seems possible to eliminate
the intermediate array entirely and have the helpers iterate directly
over adev->rings[] while filtering based on the ring type mask.

May I kno pls, would that approach make sense?

Regards,
Srini

>
> Regards,
> Christian.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH] drm/amdgpu: Reduce stack usage in IP block soft reset
  2026-06-22  9:01   ` SHANMUGAM, SRINIVASAN
@ 2026-06-22  9:10     ` SHANMUGAM, SRINIVASAN
  2026-06-22 11:07       ` Timur Kristóf
  0 siblings, 1 reply; 9+ messages in thread
From: SHANMUGAM, SRINIVASAN @ 2026-06-22  9:10 UTC (permalink / raw)
  To: Koenig, Christian, Deucher, Alexander
  Cc: amd-gfx@lists.freedesktop.org, Timur Kristóf

AMD General

> -----Original Message-----
> From: SHANMUGAM, SRINIVASAN
> Sent: Monday, June 22, 2026 2:32 PM
> To: Koenig, Christian <Christian.Koenig@amd.com>; Deucher, Alexander
> <Alexander.Deucher@amd.com>
> Cc: amd-gfx@lists.freedesktop.org; Timur Kristóf <timur.kristof@gmail.com>
> Subject: RE: [PATCH] drm/amdgpu: Reduce stack usage in IP block soft reset
>
>
>
> > -----Original Message-----
> > From: Koenig, Christian <Christian.Koenig@amd.com>
> > Sent: Monday, June 22, 2026 1:45 PM
> > To: SHANMUGAM, SRINIVASAN <SRINIVASAN.SHANMUGAM@amd.com>;
> Deucher,
> > Alexander <Alexander.Deucher@amd.com>
> > Cc: amd-gfx@lists.freedesktop.org; Timur Kristóf
> > <timur.kristof@gmail.com>
> > Subject: Re: [PATCH] drm/amdgpu: Reduce stack usage in IP block soft
> > reset
> >
> >
> >
> > On 6/19/26 19:17, Srinivasan Shanmugam 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.
> >
> > Clear NAK.
> >
> > GFP_KERNEL allocations are forbidden in the reset path.
> >
> > You could use GFP_NOWAIT or GFP_ATOMIC, but that should be avoided as
> well.
> >
> > Why is that array necessary in the first place?
>
>
> Thanks Christian.
>
> Looks like the temporary array is currently only used to collect the subset of rings
> affected by the IP block soft reset and pass them to
> amdgpu_multi_ring_reset_helper_begin() and
> amdgpu_multi_ring_reset_helper_end().
>
> amdgpu_filter_rings() simply copies matching entries from
> adev->rings[] into a temporary array, and that array is only
> iterated over by the multi-ring reset helpers.
>
> Looking at the implementation again, it seems possible to eliminate the intermediate
> array entirely and have the helpers iterate directly over adev->rings[] while filtering
> based on the ring type mask.
>
> May I kno pls, would that approach make sense?
>
> Regards,
> Srini
>

I took another look at the implementation. The temporary array is
currently only used to collect the subset of affected rings and pass
them to the multi-ring reset helpers.

amdgpu_filter_rings() simply copies matching entries from
adev->rings[] into a temporary array, and the helpers only iterate
over that array.

From what I can see, adev->rings[] appears to be a stable device ring
list, so it seems possible to eliminate the intermediate array
entirely and have the helpers iterate directly over adev->rings[]
while applying the same ring_type_mask filter.

Hi Timur, was the temporary array intended to provide snapshot semantics
for the affected rings, or was it mainly introduced for convenience?

If there is no snapshot requirement, I'll respin the patch by removing
the temporary array altogether.

Regards,
Srini

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] drm/amdgpu: Reduce stack usage in IP block soft reset
  2026-06-22  9:10     ` SHANMUGAM, SRINIVASAN
@ 2026-06-22 11:07       ` Timur Kristóf
  2026-06-22 11:18         ` SHANMUGAM, SRINIVASAN
  0 siblings, 1 reply; 9+ messages in thread
From: Timur Kristóf @ 2026-06-22 11:07 UTC (permalink / raw)
  To: Koenig, Christian, Deucher, Alexander, SHANMUGAM, SRINIVASAN
  Cc: amd-gfx@lists.freedesktop.org

On 2026. június 22., hétfő 11:10:40 közép-európai nyári idő SHANMUGAM, 
SRINIVASAN wrote:
> 
> I took another look at the implementation. The temporary array is
> currently only used to collect the subset of affected rings and pass
> them to the multi-ring reset helpers.
> 
> amdgpu_filter_rings() simply copies matching entries from
> adev->rings[] into a temporary array, and the helpers only iterate
> over that array.
> 
> From what I can see, adev->rings[] appears to be a stable device ring
> list, so it seems possible to eliminate the intermediate array
> entirely and have the helpers iterate directly over adev->rings[]
> while applying the same ring_type_mask filter.
> 
> Hi Timur, was the temporary array intended to provide snapshot semantics
> for the affected rings, or was it mainly introduced for convenience?
> 
> If there is no snapshot requirement, I'll respin the patch by removing
> the temporary array altogether.
> 
> Regards,
> Srini

Hi Srini,

I'm sorry for the trouble, I haven't seen this warning.
Please give me a moment, I can send a fix later today.

Thanks & best regards,
Timur





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] drm/amdgpu: Reduce stack usage in IP block soft reset
  2026-06-22 11:07       ` Timur Kristóf
@ 2026-06-22 11:18         ` SHANMUGAM, SRINIVASAN
  2026-06-22 11:53           ` Timur Kristóf
  0 siblings, 1 reply; 9+ messages in thread
From: SHANMUGAM, SRINIVASAN @ 2026-06-22 11:18 UTC (permalink / raw)
  To: Timur Kristóf, Koenig, Christian, Deucher, Alexander
  Cc: amd-gfx@lists.freedesktop.org

[-- Attachment #1: Type: text/plain, Size: 1997 bytes --]

AMD General



Get Outlook for Android<https://aka.ms/AAb9ysg>

________________________________
From: Timur Kristóf <timur.kristof@gmail.com>
Sent: Monday, June 22, 2026 4:39:29 PM
To: Koenig, Christian <Christian.Koenig@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; SHANMUGAM, SRINIVASAN <SRINIVASAN.SHANMUGAM@amd.com>
Cc: amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>
Subject: Re: [PATCH] drm/amdgpu: Reduce stack usage in IP block soft reset

On 2026. június 22., hétfő 11:10:40 közép-európai nyári idő SHANMUGAM,
SRINIVASAN wrote:
>
> I took another look at the implementation. The temporary array is
> currently only used to collect the subset of affected rings and pass
> them to the multi-ring reset helpers.
>
> amdgpu_filter_rings() simply copies matching entries from
> adev->rings[] into a temporary array, and the helpers only iterate
> over that array.
>
> From what I can see, adev->rings[] appears to be a stable device ring
> list, so it seems possible to eliminate the intermediate array
> entirely and have the helpers iterate directly over adev->rings[]
> while applying the same ring_type_mask filter.
>
> Hi Timur, was the temporary array intended to provide snapshot semantics
> for the affected rings, or was it mainly introduced for convenience?
>
> If there is no snapshot requirement, I'll respin the patch by removing
> the temporary array altogether.
>
> Regards,
> Srini

Hi Srini,

I'm sorry for the trouble, I haven't seen this warning.
Please give me a moment, I can send a fix later today.

Thanks & best regards,



Thanks Timur.
Sounds good.
While looking into the issue, I noticed that the temporary array is only used to collect the affected rings before passing them to the multi-ring reset helpers. It looks like the intermediate array may be avoidable by having the helpers iterate directly over adev->rings[] while applying the same ring_type_mask filter.

Thanks, Srini



[-- Attachment #2: Type: text/html, Size: 4314 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] drm/amdgpu: Reduce stack usage in IP block soft reset
  2026-06-22 11:18         ` SHANMUGAM, SRINIVASAN
@ 2026-06-22 11:53           ` Timur Kristóf
  0 siblings, 0 replies; 9+ messages in thread
From: Timur Kristóf @ 2026-06-22 11:53 UTC (permalink / raw)
  To: Koenig, Christian, Deucher, Alexander, SHANMUGAM, SRINIVASAN
  Cc: amd-gfx@lists.freedesktop.org

On 2026. június 22., hétfő 13:18:55 közép-európai nyári idő SHANMUGAM, 
SRINIVASAN wrote:
> 
> Hi Srini,
> 
> I'm sorry for the trouble, I haven't seen this warning.
> Please give me a moment, I can send a fix later today.
> 
> Thanks & best regards,
> 
> 
> 
> Thanks Timur.
> Sounds good.
> While looking into the issue, I noticed that the temporary array is only
> used to collect the affected rings before passing them to the multi-ring
> reset helpers. It looks like the intermediate array may be avoidable by
> having the helpers iterate directly over adev->rings[] while applying the
> same ring_type_mask filter.

Thank you Srini. I agree, I had the same idea in mind.

I'll write a patch this afternoon and give it some testing to make sure I 
don't accidentally regress the functionality, then I can send it to ML 
tomorrow at the latest.

Best regards,
Timur




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-06-22 11:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-19 17:17 [PATCH] drm/amdgpu: Reduce stack usage in IP block soft reset Srinivasan Shanmugam
2026-06-19 18:17 ` Alex Deucher
2026-06-20  1:17   ` SHANMUGAM, SRINIVASAN
2026-06-22  8:15 ` Christian König
2026-06-22  9:01   ` SHANMUGAM, SRINIVASAN
2026-06-22  9:10     ` SHANMUGAM, SRINIVASAN
2026-06-22 11:07       ` Timur Kristóf
2026-06-22 11:18         ` SHANMUGAM, SRINIVASAN
2026-06-22 11:53           ` Timur Kristóf

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.