]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
drm/amd/ras: Reduce stack usage in amdgpu_virt_ras_get_cper_records()
authorSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Fri, 5 Dec 2025 12:15:10 +0000 (17:45 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 10 Dec 2025 22:37:50 +0000 (17:37 -0500)
commit6ef93f62533e4176f0aa94d125d742b778cee07e
treef525e43ab4436cd66c8e365308efbc686328ee97
parent5b57c3c3f22336e8fd5edb7f0fef3c7823f8eac1
drm/amd/ras: Reduce stack usage in amdgpu_virt_ras_get_cper_records()

amdgpu_virt_ras_get_cper_records() was using a large stack array
of ras_log_info pointers. This contributed to the frame size
warning on this function.

Replace the fixed-size stack array:

    struct ras_log_info *trace[MAX_RECORD_PER_BATCH];

with a heap-allocated array using kcalloc().

We free the trace buffer together with out_buf on all exit paths.
If allocation of trace or out_buf fails, we return a generic RAS
error code.

This reduces stack usage and keeps the runtime behaviour
unchanged.

Fixes:
stack frame size: 1112 bytes (limit: 1024)

Cc: Tao Zhou <tao.zhou1@amd.com>
Cc: Hawking Zhang <Hawking.Zhang@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_virt_ras_cmd.c