Skip to contentSkip to conversation

drm/amd/pm: Avoid more large frame warnings

PATCH In review Palmer Dabbelt 2 participants 4 messages Jun 10, 2025 – Jun 12, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd/pm: Avoid more large frame warnings

From: Palmer Dabbelt <[email protected]>

9KiB frames seem pretty big, but without this I'm getting some warnings as of 6.16-rc1

      CC [M]  drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu13/smu_v13_0_6_ppt.o
    drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu13/smu_v13_0_6_ppt.c: In function 'smu_v13_0_6_get_gpu_metrics':
    drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu13/smu_v13_0_6_ppt.c:2885:1: error: the frame size of 8304 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
     2885 | }
          | ^
    cc1: all warnings being treated as errors
---
 drivers/gpu/drm/amd/pm/swsmu/smu13/Makefile | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/smu13/Makefile +10 -0
index 51f1fa9789ab..9824b7f4827f 100644
@@ -23,9 +23,19 @@
 # Makefile for the 'smu manager' sub-component of powerplay.
 # It provides the smu management services for the driver.
 
+ifneq ($(CONFIG_FRAME_WARN),0)
+    frame_warn_limit := 9216
+    ifeq ($(call test-lt, $(CONFIG_FRAME_WARN), $(frame_warn_limit)),y)
+        frame_warn_flag := -Wframe-larger-than=$(frame_warn_limit)
+    endif
+endif
+
 SMU13_MGR = smu_v13_0.o aldebaran_ppt.o yellow_carp_ppt.o smu_v13_0_0_ppt.o smu_v13_0_4_ppt.o \
 	    smu_v13_0_5_ppt.o smu_v13_0_7_ppt.o smu_v13_0_6_ppt.o smu_v13_0_12_ppt.o
 
 AMD_SWSMU_SMU13MGR = $(addprefix $(AMD_SWSMU_PATH)/smu13/,$(SMU13_MGR))
 
 AMD_POWERPLAY_FILES += $(AMD_SWSMU_SMU13MGR)
+
+CFLAGS_$(AMD_SWSMU_PATH)/smu13/smu_v13_0_12_ppt.o := $(frame_warn_flag)
+CFLAGS_$(AMD_SWSMU_PATH)/smu13/smu_v13_0_6_ppt.o := $(frame_warn_flag)
Signature · 1 line
2.39.5 (Apple Git-154)
#1 lore raw
Quoted 5 lines · Palmer Dabbelt

From: Palmer Dabbelt <[email protected]>

9KiB frames seem pretty big, but without this I'm getting some warnings as of 6.16-rc1

Quoted 7 lines
      CC [M]  drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu13/smu_v13_0_6_ppt.o
    drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu13/smu_v13_0_6_ppt.c: In function 'smu_v13_0_6_get_gpu_metrics':
    drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu13/smu_v13_0_6_ppt.c:2885:1: error: the frame size of 8304 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
     2885 | }
          | ^
    cc1: all warnings being treated as errors

Could you also provide your build environment details?

With below in Makefile + gcc 11.4.0, stack frame size is 168 bytes.

ccflags-y += -fstack-usage

smu_v13_0_6_ppt.c:2667:16:smu_v13_0_6_get_gpu_metrics 168 static

Thanks,
Lijo

Quoted 29 lines
---
 drivers/gpu/drm/amd/pm/swsmu/smu13/Makefile | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/smu13/Makefile +10 -0
index 51f1fa9789ab..9824b7f4827f 100644
@@ -23,9 +23,19 @@
 # Makefile for the 'smu manager' sub-component of powerplay.
 # It provides the smu management services for the driver.
 
+ifneq ($(CONFIG_FRAME_WARN),0)
+    frame_warn_limit := 9216
+    ifeq ($(call test-lt, $(CONFIG_FRAME_WARN), $(frame_warn_limit)),y)
+        frame_warn_flag := -Wframe-larger-than=$(frame_warn_limit)
+    endif
+endif
+
 SMU13_MGR = smu_v13_0.o aldebaran_ppt.o yellow_carp_ppt.o smu_v13_0_0_ppt.o smu_v13_0_4_ppt.o \
 	    smu_v13_0_5_ppt.o smu_v13_0_7_ppt.o smu_v13_0_6_ppt.o smu_v13_0_12_ppt.o
 
 AMD_SWSMU_SMU13MGR = $(addprefix $(AMD_SWSMU_PATH)/smu13/,$(SMU13_MGR))
 
 AMD_POWERPLAY_FILES += $(AMD_SWSMU_SMU13MGR)
+
+CFLAGS_$(AMD_SWSMU_PATH)/smu13/smu_v13_0_12_ppt.o := $(frame_warn_flag)
+CFLAGS_$(AMD_SWSMU_PATH)/smu13/smu_v13_0_6_ppt.o := $(frame_warn_flag)
#2 lore raw
Quoted 18 lines · Lijo
Quoted 5 lines · Palmer Dabbelt

From: Palmer Dabbelt <[email protected]>

9KiB frames seem pretty big, but without this I'm getting some warnings as of 6.16-rc1

Quoted 7 lines
      CC [M]  drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu13/smu_v13_0_6_ppt.o
    drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu13/smu_v13_0_6_ppt.c: In function 'smu_v13_0_6_get_gpu_metrics':
    drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu13/smu_v13_0_6_ppt.c:2885:1: error: the frame size of 8304 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
     2885 | }
          | ^
    cc1: all warnings being treated as errors

Could you also provide your build environment details?

Quoted 9 lines

With below in Makefile + gcc 11.4.0, stack frame size is 168 bytes.

ccflags-y += -fstack-usage

smu_v13_0_6_ppt.c:2667:16:smu_v13_0_6_get_gpu_metrics 168 static

Thanks,
Lijo

Was able to see this issue in one of our systems. This patch fixed that
- https://patchwork.freedesktop.org/patch/658216/

Please try and let me know if it works for your config.

Thanks,
Lijo

Quoted 30 lines
Quoted 29 lines
---
 drivers/gpu/drm/amd/pm/swsmu/smu13/Makefile | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/smu13/Makefile +10 -0
index 51f1fa9789ab..9824b7f4827f 100644
@@ -23,9 +23,19 @@
 # Makefile for the 'smu manager' sub-component of powerplay.
 # It provides the smu management services for the driver.
 
+ifneq ($(CONFIG_FRAME_WARN),0)
+    frame_warn_limit := 9216
+    ifeq ($(call test-lt, $(CONFIG_FRAME_WARN), $(frame_warn_limit)),y)
+        frame_warn_flag := -Wframe-larger-than=$(frame_warn_limit)
+    endif
+endif
+
 SMU13_MGR = smu_v13_0.o aldebaran_ppt.o yellow_carp_ppt.o smu_v13_0_0_ppt.o smu_v13_0_4_ppt.o \
 	    smu_v13_0_5_ppt.o smu_v13_0_7_ppt.o smu_v13_0_6_ppt.o smu_v13_0_12_ppt.o
 
 AMD_SWSMU_SMU13MGR = $(addprefix $(AMD_SWSMU_PATH)/smu13/,$(SMU13_MGR))
 
 AMD_POWERPLAY_FILES += $(AMD_SWSMU_SMU13MGR)
+
+CFLAGS_$(AMD_SWSMU_PATH)/smu13/smu_v13_0_12_ppt.o := $(frame_warn_flag)
+CFLAGS_$(AMD_SWSMU_PATH)/smu13/smu_v13_0_6_ppt.o := $(frame_warn_flag)
#3 lore raw
Quoted 19 lines · On Thu, 12 Jun 2025 05:29:55 PDT (-0700), [email protected] wrote:
Quoted 16 lines · Lijo
Quoted 12 lines · Palmer Dabbelt

From: Palmer Dabbelt <[email protected]>

9KiB frames seem pretty big, but without this I'm getting some warnings as of 6.16-rc1

      CC [M]  drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu13/smu_v13_0_6_ppt.o
    drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu13/smu_v13_0_6_ppt.c: In function 'smu_v13_0_6_get_gpu_metrics':
    drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu13/smu_v13_0_6_ppt.c:2885:1: error: the frame size of 8304 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
     2885 | }
          | ^
    cc1: all warnings being treated as errors
Quoted 3 lines
Quoted 3 lines

Could you also provide your build environment details?

With below in Makefile + gcc 11.4.0, stack frame size is 168 bytes.

I'm on GCC 12 on RISC-V (though looks like it showed up somewhere else, too).

Quoted 5 lines
Quoted 5 lines

ccflags-y += -fstack-usage

smu_v13_0_6_ppt.c:2667:16:smu_v13_0_6_get_gpu_metrics 168 static

Quoted 8 lines
Quoted 3 lines

Thanks,
Lijo

Was able to see this issue in one of our systems. This patch fixed that
- https://patchwork.freedesktop.org/patch/658216/

Please try and let me know if it works for your config.

Thanks, I just threw it at the tester. I'll go post a Reviewed-by at https://lore.kernel.org/all/[email protected]/ if it works...

Quoted 34 lines

Thanks,
Lijo

Quoted 30 lines
Quoted 29 lines
---
 drivers/gpu/drm/amd/pm/swsmu/smu13/Makefile | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/smu13/Makefile +10 -0
index 51f1fa9789ab..9824b7f4827f 100644
@@ -23,9 +23,19 @@
 # Makefile for the 'smu manager' sub-component of powerplay.
 # It provides the smu management services for the driver.
 
+ifneq ($(CONFIG_FRAME_WARN),0)
+    frame_warn_limit := 9216
+    ifeq ($(call test-lt, $(CONFIG_FRAME_WARN), $(frame_warn_limit)),y)
+        frame_warn_flag := -Wframe-larger-than=$(frame_warn_limit)
+    endif
+endif
+
 SMU13_MGR = smu_v13_0.o aldebaran_ppt.o yellow_carp_ppt.o smu_v13_0_0_ppt.o smu_v13_0_4_ppt.o \
 	    smu_v13_0_5_ppt.o smu_v13_0_7_ppt.o smu_v13_0_6_ppt.o smu_v13_0_12_ppt.o
 
 AMD_SWSMU_SMU13MGR = $(addprefix $(AMD_SWSMU_PATH)/smu13/,$(SMU13_MGR))
 
 AMD_POWERPLAY_FILES += $(AMD_SWSMU_SMU13MGR)
+
+CFLAGS_$(AMD_SWSMU_PATH)/smu13/smu_v13_0_12_ppt.o := $(frame_warn_flag)
+CFLAGS_$(AMD_SWSMU_PATH)/smu13/smu_v13_0_6_ppt.o := $(frame_warn_flag)