[AMD Official Use Only - General] Thanks for looking into this. I got an email about this from kernel test robot, can you add this also to the commit message: Reported-by: kernel test robot <lkp@xxxxxxxxx> Closes: https://lore.kernel.org/oe-kbuild-all/202307080505.V12qS0oz-lkp@xxxxxxxxx Reviewed-by: Mukul Joshi <mukul.joshi@xxxxxxx> > -----Original Message----- > From: amd-gfx <amd-gfx-bounces@xxxxxxxxxxxxxxxxxxxxx> On Behalf Of > Srinivasan Shanmugam > Sent: Sunday, July 9, 2023 11:22 PM > To: Koenig, Christian <Christian.Koenig@xxxxxxx>; Deucher, Alexander > <Alexander.Deucher@xxxxxxx>; Kuehling, Felix <Felix.Kuehling@xxxxxxx>; > Chen, Guchun <Guchun.Chen@xxxxxxx> > Cc: SHANMUGAM, SRINIVASAN <SRINIVASAN.SHANMUGAM@xxxxxxx>; > amd-gfx@xxxxxxxxxxxxxxxxxxxxx > Subject: [PATCH v3] drm/amdkfd: Fix stack size in > 'amdgpu_amdkfd_unmap_hiq' > > Caution: This message originated from an External Source. Use proper caution > when opening attachments, clicking links, or responding. > > > Allocate large local variable on heap to avoid exceeding the stack size: > drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c: In function > ‘amdgpu_amdkfd_unmap_hiq’: > drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c:868:1: warning: the > frame size of 1280 bytes is larger than 1024 bytes [-Wframe-larger-than=] > > Suggested-by: Guchun Chen <guchun.chen@xxxxxxx> > Cc: Felix Kuehling <Felix.Kuehling@xxxxxxx> > Cc: Christian König <christian.koenig@xxxxxxx> > Cc: Alex Deucher <alexander.deucher@xxxxxxx> > Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@xxxxxxx> > --- > > v3: > - free ring_funcs before 'return -ENOMEM' (Guchun). > - keep the check of ' kiq->pmf' and 'kiq->pmf->kiq_unmap_queues' ahead > of allocation of ring & ring_funcs (Guchun). > > drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 32 > ++++++++++++++++------ > 1 file changed, 23 insertions(+), 9 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c > index 0040c63e2356..629ca1ad75a8 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c > @@ -836,33 +836,47 @@ int amdgpu_amdkfd_unmap_hiq(struct > amdgpu_device *adev, u32 doorbell_off, { > struct amdgpu_kiq *kiq = &adev->gfx.kiq[inst]; > struct amdgpu_ring *kiq_ring = &kiq->ring; > - struct amdgpu_ring_funcs ring_funcs; > - struct amdgpu_ring ring; > + struct amdgpu_ring_funcs *ring_funcs; > + struct amdgpu_ring *ring; > int r = 0; > > if (!kiq->pmf || !kiq->pmf->kiq_unmap_queues) > return -EINVAL; > > - memset(&ring, 0x0, sizeof(struct amdgpu_ring)); > - memset(&ring_funcs, 0x0, sizeof(struct amdgpu_ring_funcs)); > + ring_funcs = kzalloc(sizeof(*ring_funcs), GFP_KERNEL); > + if (!ring_funcs) > + return -ENOMEM; > + > + ring = kzalloc(sizeof(*ring), GFP_KERNEL); > + if (!ring) { > + r = -ENOMEM; > + goto free_ring_funcs; > + } > > - ring_funcs.type = AMDGPU_RING_TYPE_COMPUTE; > - ring.doorbell_index = doorbell_off; > - ring.funcs = &ring_funcs; > + ring_funcs->type = AMDGPU_RING_TYPE_COMPUTE; > + ring->doorbell_index = doorbell_off; > + ring->funcs = ring_funcs; > > spin_lock(&kiq->ring_lock); > > if (amdgpu_ring_alloc(kiq_ring, kiq->pmf->unmap_queues_size)) { > spin_unlock(&kiq->ring_lock); > - return -ENOMEM; > + r = -ENOMEM; > + goto free_ring; > } > > - kiq->pmf->kiq_unmap_queues(kiq_ring, &ring, RESET_QUEUES, 0, 0); > + kiq->pmf->kiq_unmap_queues(kiq_ring, ring, RESET_QUEUES, 0, 0); > > if (kiq_ring->sched.ready && !adev->job_hang) > r = amdgpu_ring_test_helper(kiq_ring); > > spin_unlock(&kiq->ring_lock); > > +free_ring: > + kfree(ring); > + > +free_ring_funcs: > + kfree(ring_funcs); > + > return r; > } > -- > 2.25.1
<<attachment: winmail.dat>>