Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amdgpu/acpi: Reduce amdgpu_acpi_detect stack usage

amdgpu_acpi_detect() calls some helper functions it calls have large
local structures. When the compiler inlines these helpers, their local
data adds to the amdgpu_acpi_detect() stack frame.

Mark the helpers with noinline_for_stack:
- amdgpu_atif_verify_interface()
- amdgpu_atif_get_notification_params()
- amdgpu_atif_query_backlight_caps()
- amdgpu_atcs_verify_interface()
- amdgpu_acpi_enumerate_xcc()

This keeps the large temporary objects inside the helper’s own stack
frame instead of being inlined into the caller, preventing the caller
from growing beyond the stack limit.

Fixes the below with gcc W=1:
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:1403:6: warning: stack frame size (1688) exceeds limit (1024) in 'amdgpu_acpi_detect' [-Wframe-larger-than]

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Srinivasan Shanmugam and committed by
Alex Deucher
495b1904 35bb80e6

+10 -5
+10 -5
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
··· 241 241 * (all asics). 242 242 * returns 0 on success, error on failure. 243 243 */ 244 - static int amdgpu_atif_verify_interface(struct amdgpu_atif *atif) 244 + static noinline_for_stack 245 + int amdgpu_atif_verify_interface(struct amdgpu_atif *atif) 245 246 { 246 247 union acpi_object *info; 247 248 struct atif_verify_interface output; ··· 287 286 * where n is specified in the result if a notifier is used. 288 287 * Returns 0 on success, error on failure. 289 288 */ 290 - static int amdgpu_atif_get_notification_params(struct amdgpu_atif *atif) 289 + static noinline_for_stack 290 + int amdgpu_atif_get_notification_params(struct amdgpu_atif *atif) 291 291 { 292 292 union acpi_object *info; 293 293 struct amdgpu_atif_notification_cfg *n = &atif->notification_cfg; ··· 356 354 * 357 355 * Returns 0 on success, error on failure. 358 356 */ 359 - static int amdgpu_atif_query_backlight_caps(struct amdgpu_atif *atif) 357 + static noinline_for_stack 358 + int amdgpu_atif_query_backlight_caps(struct amdgpu_atif *atif) 360 359 { 361 360 union acpi_object *info; 362 361 struct atif_qbtc_output characteristics; ··· 603 600 * (all asics). 604 601 * returns 0 on success, error on failure. 605 602 */ 606 - static int amdgpu_atcs_verify_interface(struct amdgpu_atcs *atcs) 603 + static noinline_for_stack 604 + int amdgpu_atcs_verify_interface(struct amdgpu_atcs *atcs) 607 605 { 608 606 union acpi_object *info; 609 607 struct atcs_verify_interface output; ··· 1093 1089 return ret; 1094 1090 } 1095 1091 1096 - static int amdgpu_acpi_enumerate_xcc(void) 1092 + static noinline_for_stack 1093 + int amdgpu_acpi_enumerate_xcc(void) 1097 1094 { 1098 1095 struct amdgpu_acpi_dev_info *dev_info = NULL; 1099 1096 struct amdgpu_acpi_xcc_info *xcc_info;