Skip to contentSkip to conversation

drm/amd/display: Increase sanitizer frame larger than limit when compile testing with clang

PATCH Applied Nathan Chancellor 4 participants 7 messages Dec 19, 2024 – Jan 30, 2025

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

PATCH 1/1 drm/amd/display: Increase sanitizer frame larger than limit when compile testing with clang

Commit 24909d9ec7c3 ("drm/amd/display: Overwriting dualDPP UBF values before usage") added a new warning in dml2/display_mode_core.c when building allmodconfig with clang:

drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.c:6268:13: error: stack frame size (3128) exceeds limit (3072) in 'dml_prefetch_check' [-Werror,-Wframe-larger-than]
6268 | static void dml_prefetch_check(struct display_mode_lib_st *mode_lib)
| ^

Commit be4e3509314a ("drm/amd/display: DML21 Reintegration For Various Fixes") introduced one in dml2_core/dml2_core_dcn4_calcs.c with the same configuration:

drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/dml21/src/dml2_core/dml2_core_dcn4_calcs.c:7236:13: error: stack frame size (3256) exceeds limit (3072) in 'dml_core_mode_support' [-Werror,-Wframe-larger-than]
7236 | static bool dml_core_mode_support(struct dml2_core_calcs_mode_support_ex *in_out_params)
| ^

In the case of the first warning, the stack usage was already at the limit at the parent change, so the offending change was rather innocuous. In the case of the second warning, there was a rather dramatic increase in stack usage compared to the parent:

drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/dml21/src/dml2_core/dml2_core_dcn4_calcs.c:7032:13: error: stack frame size (2696) exceeds limit (2048) in 'dml_core_mode_support' [-Werror,-Wframe-larger-than]
7032 | static bool dml_core_mode_support(struct dml2_core_calcs_mode_support_ex *in_out_params)
| ^

This is an unfortunate interaction between an issue with stack slot reuse in LLVM that gets exacerbated by sanitization (which gets enabled with all{mod,yes}config) and function calls using a much higher number of parameters than is typical in the kernel, necessitating passing most of these values on the stack.

While it is possible that there should be source code changes to address these warnings, this code is difficult to modify for various reasons, as has been noted in other changes that have occurred for similar reasons, such as commit 6740ec97bcdb ("drm/amd/display: Increase frame warning limit with KASAN or KCSAN in dml2").

Increase the frame larger than limit when compile testing with clang and the sanitizers enabled to avoid this breakage in all{mod,yes}config, as they are commonly used and valuable testing targets. While it is not the best to hide this issue, it is not really relevant when compile testing, as the sanitizers are commonly stressful on optimizations and they are only truly useful at runtime, which COMPILE_TEST states will not occur with the current build.

---
 drivers/gpu/drm/amd/display/dc/dml2/Makefile | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/display/dc/dml2/Makefile +4 -0
index d9c27ebe12ee08d6330eb199cd8ca9c8489fa5b2..91c4f3b4bd5f46ac5c1c74f665b06dbe61081917 100644
@@ -29,7 +29,11 @@ dml2_rcflags := $(CC_FLAGS_NO_FPU)
 
 ifneq ($(CONFIG_FRAME_WARN),0)
 ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y)
+ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_COMPILE_TEST),yy)
+frame_warn_flag := -Wframe-larger-than=4096
+else
 frame_warn_flag := -Wframe-larger-than=3072
+endif
 else
 frame_warn_flag := -Wframe-larger-than=2048
 endif

---
base-commit: 695c2c745e5dff201b75da8a1d237ce403600d04
change-id: 20241219-amdgpu-dml2-address-clang-frame-larger-than-allconfig-f034d9c5118e

Best regards,

Signature · 1 line
Nathan Chancellor <[email protected]>
Applied
#1 lore raw

Applied. Thanks!

Quoted 78 lines · Nathan Chancellor

Commit 24909d9ec7c3 ("drm/amd/display: Overwriting dualDPP UBF values before usage") added a new warning in dml2/display_mode_core.c when building allmodconfig with clang:

drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.c:6268:13: error: stack frame size (3128) exceeds limit (3072) in 'dml_prefetch_check' [-Werror,-Wframe-larger-than]
6268 | static void dml_prefetch_check(struct display_mode_lib_st *mode_lib)
| ^

Commit be4e3509314a ("drm/amd/display: DML21 Reintegration For Various Fixes") introduced one in dml2_core/dml2_core_dcn4_calcs.c with the same configuration:

drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/dml21/src/dml2_core/dml2_core_dcn4_calcs.c:7236:13: error: stack frame size (3256) exceeds limit (3072) in 'dml_core_mode_support' [-Werror,-Wframe-larger-than]
7236 | static bool dml_core_mode_support(struct dml2_core_calcs_mode_support_ex *in_out_params)
| ^

In the case of the first warning, the stack usage was already at the limit at the parent change, so the offending change was rather innocuous. In the case of the second warning, there was a rather dramatic increase in stack usage compared to the parent:

drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/dml21/src/dml2_core/dml2_core_dcn4_calcs.c:7032:13: error: stack frame size (2696) exceeds limit (2048) in 'dml_core_mode_support' [-Werror,-Wframe-larger-than]
7032 | static bool dml_core_mode_support(struct dml2_core_calcs_mode_support_ex *in_out_params)
| ^

This is an unfortunate interaction between an issue with stack slot reuse in LLVM that gets exacerbated by sanitization (which gets enabled with all{mod,yes}config) and function calls using a much higher number of parameters than is typical in the kernel, necessitating passing most of these values on the stack.

While it is possible that there should be source code changes to address these warnings, this code is difficult to modify for various reasons, as has been noted in other changes that have occurred for similar reasons, such as commit 6740ec97bcdb ("drm/amd/display: Increase frame warning limit with KASAN or KCSAN in dml2").

Increase the frame larger than limit when compile testing with clang and the sanitizers enabled to avoid this breakage in all{mod,yes}config, as they are commonly used and valuable testing targets. While it is not the best to hide this issue, it is not really relevant when compile testing, as the sanitizers are commonly stressful on optimizations and they are only truly useful at runtime, which COMPILE_TEST states will not occur with the current build.

---
 drivers/gpu/drm/amd/display/dc/dml2/Makefile | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/display/dc/dml2/Makefile +4 -1
index d9c27ebe12ee08d6330eb199cd8ca9c8489fa5b2..91c4f3b4bd5f46ac5c1c74f665b06dbe61081917 100644
@@ -29,7 +29,11 @@ dml2_rcflags := $(CC_FLAGS_NO_FPU)
 
 ifneq ($(CONFIG_FRAME_WARN),0)
 ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y)
+ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_COMPILE_TEST),yy)
+frame_warn_flag := -Wframe-larger-than=4096
+else
 frame_warn_flag := -Wframe-larger-than=3072
+endif
 else
 frame_warn_flag := -Wframe-larger-than=2048
 endif
 
---

base-commit: 695c2c745e5dff201b75da8a1d237ce403600d04
change-id: 20241219-amdgpu-dml2-address-clang-frame-larger-than-allconfig-f034d9c5118e

Best regards,
--
Nathan Chancellor <[email protected]>

#2 lore raw
Quoted 1 line · Alex Deucher

Applied. Thanks!

Thanks, but I am still getting this error on Linus's current tree right now, with this commit applied:

CC [M] drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.o
drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.c:6713:12: error: stack frame size (2056) exceeds limit (2048) in 'dml_core_mode_support' [-Werror,-Wframe-larger-than]
6713 | dml_bool_t dml_core_mode_support(struct display_mode_lib_st *mode_lib)
| ^
1 error generated.

I think the issue is:

Quoted 6 lines

drivers/gpu/drm/amd/display/dc/dml2/Makefile dml2_rcflags := $(CC_FLAGS_NO_FPU) · line 31

Quoted 6 lines
drivers/gpu/drm/amd/display/dc/dml2/Makefile +0 -0
@@ -29,7 +29,11 @@ dml2_rcflags := $(CC_FLAGS_NO_FPU)
 
 ifneq ($(CONFIG_FRAME_WARN),0)
 ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y)

I do not have CONFIG_KASAN or CONFIG_KCSAN enabled, but I do have:

Quoted 1 line

drivers/gpu/drm/amd/display/dc/dml2/Makefile dml2_rcflags := $(CC_FLAGS_NO_FPU) · line 32

Quoted 1 line
drivers/gpu/drm/amd/display/dc/dml2/Makefile +1 -0
+ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_COMPILE_TEST),yy)

These two options enabled, and for some reason:

	CONFIG_FRAME_WARN=2048

as well.

Ah, 2048 is the default value, that's how.

So this warning triggers even without KASAN or KCSAN being enabled, is that to be expected? Is the stack really being used that much here?

I'll go bump FRAME_WARN up to get some local testing working again, but odds are others are going to hit this if I am in my "normal" build tests.

thanks,

greg k-h

#3 lore raw
Quoted 30 lines · Greg KH
Quoted 1 line · Alex Deucher

Applied. Thanks!

Thanks, but I am still getting this error on Linus's current tree right now, with this commit applied:

CC [M] drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.o
drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.c:6713:12: error: stack frame size (2056) exceeds limit (2048) in 'dml_core_mode_support' [-Werror,-Wframe-larger-than]
6713 | dml_bool_t dml_core_mode_support(struct display_mode_lib_st *mode_lib)
| ^
1 error generated.

I think the issue is:

Quoted 6 lines

drivers/gpu/drm/amd/display/dc/dml2/Makefile dml2_rcflags := $(CC_FLAGS_NO_FPU) · line 31

Quoted 6 lines
drivers/gpu/drm/amd/display/dc/dml2/Makefile +0 -0
@@ -29,7 +29,11 @@ dml2_rcflags := $(CC_FLAGS_NO_FPU)
 
 ifneq ($(CONFIG_FRAME_WARN),0)
 ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y)

I do not have CONFIG_KASAN or CONFIG_KCSAN enabled, but I do have:

Quoted 1 line

drivers/gpu/drm/amd/display/dc/dml2/Makefile dml2_rcflags := $(CC_FLAGS_NO_FPU) · line 32

Quoted 1 line
drivers/gpu/drm/amd/display/dc/dml2/Makefile +1 -0
+ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_COMPILE_TEST),yy)

These two options enabled, and for some reason:

	CONFIG_FRAME_WARN=2048

as well.

Quoted 8 lines

Ah, 2048 is the default value, that's how.

So this warning triggers even without KASAN or KCSAN being enabled, is that to be expected? Is the stack really being used that much here?

I'll go bump FRAME_WARN up to get some local testing working again, but odds are others are going to hit this if I am in my "normal" build tests.

Ick, no, bumping CONFIG_FRAME_WARN=8192 doesn't fix this here either. Any hints?

thanks,

greg k-h

maintainer
#4 lore raw
Quoted 36 lines · Greg KH
Quoted 35 lines · Greg KH
Quoted 1 line · Alex Deucher

Applied. Thanks!

Thanks, but I am still getting this error on Linus's current tree right now, with this commit applied:

CC [M] drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.o
drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.c:6713:12: error: stack frame size (2056) exceeds limit (2048) in 'dml_core_mode_support' [-Werror,-Wframe-larger-than]
6713 | dml_bool_t dml_core_mode_support(struct display_mode_lib_st *mode_lib)
| ^
1 error generated.

I think the issue is:

Quoted 6 lines

drivers/gpu/drm/amd/display/dc/dml2/Makefile dml2_rcflags := $(CC_FLAGS_NO_FPU) · line 31

Quoted 6 lines
drivers/gpu/drm/amd/display/dc/dml2/Makefile +0 -0
@@ -29,7 +29,11 @@ dml2_rcflags := $(CC_FLAGS_NO_FPU)
 
  ifneq ($(CONFIG_FRAME_WARN),0)
  ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y)

I do not have CONFIG_KASAN or CONFIG_KCSAN enabled, but I do have:

Quoted 1 line

drivers/gpu/drm/amd/display/dc/dml2/Makefile dml2_rcflags := $(CC_FLAGS_NO_FPU) · line 32

Quoted 1 line
drivers/gpu/drm/amd/display/dc/dml2/Makefile +1 -0
+ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_COMPILE_TEST),yy)

These two options enabled, and for some reason:

	CONFIG_FRAME_WARN=2048

as well.

Ah, 2048 is the default value, that's how.

So this warning triggers even without KASAN or KCSAN being enabled, is that to be expected? Is the stack really being used that much here?

Quoted 7 lines
Quoted 3 lines

I'll go bump FRAME_WARN up to get some local testing working again, but odds are others are going to hit this if I am in my "normal" build tests.

Ick, no, bumping CONFIG_FRAME_WARN=8192 doesn't fix this here either. Any hints?

It looks like we always override CONFIG_FRAME_WARN...

Quoted 9 lines

ifneq ($(CONFIG_FRAME_WARN),0)
ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y) ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_COMPILE_TEST),yy) frame_warn_flag := -Wframe-larger-than=4096 else
frame_warn_flag := -Wframe-larger-than=3072 endif
else
frame_warn_flag := -Wframe-larger-than=2048

... right here for the default case.

You could bump that locally.

A more robust solution would be to do a greater-than check here (for all the cases) and only set -Wframe-larger-than if the value is greater than the one defined by CONFIG_FRAME_WARN. There are a few "-gt" uses in other Makefiles, so I would think it's fine to use that.

I'm no Makefile expert but if this seems like a reasonable course of action I can take a stab at it.

Harry

Quoted 8 lines

endif
endif

thanks,

greg k-h

#5 lore raw

Hey Greg and Harry,

Quoted 10 lines · Harry Wentland
Quoted 9 lines · Greg KH
Quoted 8 lines · Greg KH

Thanks, but I am still getting this error on Linus's current tree right now, with this commit applied:

CC [M] drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.o
drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/display_mode_core.c:6713:12: error: stack frame size (2056) exceeds limit (2048) in 'dml_core_mode_support' [-Werror,-Wframe-larger-than]
6713 | dml_bool_t dml_core_mode_support(struct display_mode_lib_st *mode_lib)
| ^
1 error generated.

Bummer, that means that commit a8d42cd228ec ("drm/amd/display: mark static functions noinline_for_stack") did not help this case like I had hoped that it would.

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines

I think the issue is:

Quoted 6 lines

drivers/gpu/drm/amd/display/dc/dml2/Makefile dml2_rcflags := $(CC_FLAGS_NO_FPU) · line 31

Quoted 6 lines
drivers/gpu/drm/amd/display/dc/dml2/Makefile +0 -0
@@ -29,7 +29,11 @@ dml2_rcflags := $(CC_FLAGS_NO_FPU)
 
  ifneq ($(CONFIG_FRAME_WARN),0)
  ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y)

I do not have CONFIG_KASAN or CONFIG_KCSAN enabled, but I do have:

Quoted 1 line
Quoted 1 line
drivers/gpu/drm/amd/display/dc/dml2/Makefile +1 -0
+ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_COMPILE_TEST),yy)
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

These two options enabled, and for some reason:

	CONFIG_FRAME_WARN=2048

as well.

Ah, 2048 is the default value, that's how.

So this warning triggers even without KASAN or KCSAN being enabled, is that to be expected? Is the stack really being used that much here?

It is entirely possible. Look at how many parameters there are to some of these functions, which have to be passed on the stack when the compiler runs out of registers. When I looked into this at one point, GCC was barely doing better than Clang in certain configurations. What version of clang is this and would you mind sharing your configuration?

Quoted 24 lines
Quoted 7 lines
Quoted 3 lines

I'll go bump FRAME_WARN up to get some local testing working again, but odds are others are going to hit this if I am in my "normal" build tests.

Ick, no, bumping CONFIG_FRAME_WARN=8192 doesn't fix this here either. Any hints?

It looks like we always override CONFIG_FRAME_WARN...

Quoted 9 lines

ifneq ($(CONFIG_FRAME_WARN),0)
ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y) ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_COMPILE_TEST),yy) frame_warn_flag := -Wframe-larger-than=4096 else
frame_warn_flag := -Wframe-larger-than=3072 endif
else
frame_warn_flag := -Wframe-larger-than=2048

... right here for the default case.

You could bump that locally.

Quoted 8 lines

A more robust solution would be to do a greater-than check here (for all the cases) and only set -Wframe-larger-than if the value is greater than the one defined by CONFIG_FRAME_WARN. There are a few "-gt" uses in other Makefiles, so I would think it's fine to use that.

I'm no Makefile expert but if this seems like a reasonable course of action I can take a stab at it.

Something like this would work I think? I added indentation because it was getting a little gnarly. I am happy to write a formal patch and send it off if this looks acceptable.

drivers/gpu/drm/amd/display/dc/dml/Makefile +9 -5
index 46f9c05de16e..e1d500633dfa 100644
@@ -29,11 +29,15 @@ dml_ccflags := $(CC_FLAGS_FPU)
 dml_rcflags := $(CC_FLAGS_NO_FPU)
 
 ifneq ($(CONFIG_FRAME_WARN),0)
-ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y)
-frame_warn_flag := -Wframe-larger-than=3072
-else
-frame_warn_flag := -Wframe-larger-than=2048
-endif
+    ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y)
+        frame_warn_limit := 3072
+    else
+        frame_warn_limit := 2048
+    endif
+
+    ifeq ($(call test-lt, $(CONFIG_FRAME_WARN), $(frame_warn_limit)),y)
+        frame_warn_flag := -Wframe-larger-than=$(frame_warn_limit)
+    endif
 endif
 
 CFLAGS_$(AMDDALPATH)/dc/dml/display_mode_lib.o := $(dml_ccflags)
drivers/gpu/drm/amd/display/dc/dml2/Makefile +13 -9
index 91c4f3b4bd5f..21fd466dba26 100644
@@ -28,15 +28,19 @@ dml2_ccflags := $(CC_FLAGS_FPU)
 dml2_rcflags := $(CC_FLAGS_NO_FPU)
 
 ifneq ($(CONFIG_FRAME_WARN),0)
-ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y)
-ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_COMPILE_TEST),yy)
-frame_warn_flag := -Wframe-larger-than=4096
-else
-frame_warn_flag := -Wframe-larger-than=3072
-endif
-else
-frame_warn_flag := -Wframe-larger-than=2048
-endif
+    ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y)
+        ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_COMPILE_TEST),yy)
+            frame_warn_limit := 4096
+        else
+            frame_warn_limit := 3072
+        endif
+    else
+        frame_warn_limit := 2048
+    endif
+
+    ifeq ($(call test-lt, $(CONFIG_FRAME_WARN), $(frame_warn_limit)),y)
+        frame_warn_flag := -Wframe-larger-than=$(frame_warn_limit)
+    endif
 endif
 
 subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/dml2
maintainer
#6 lore raw
Quoted 2 lines · Nathan Chancellor

Hey Greg and Harry,

[snip]

Quoted 6 lines
Quoted 6 lines

A more robust solution would be to do a greater-than check here (for all the cases) and only set -Wframe-larger-than if the value is greater than the one defined by CONFIG_FRAME_WARN. There are a few "-gt" uses in other Makefiles, so I would think it's fine to use that.

Quoted 6 lines
Quoted 2 lines

I'm no Makefile expert but if this seems like a reasonable course of action I can take a stab at it.

Something like this would work I think? I added indentation because it was getting a little gnarly. I am happy to write a formal patch and send it off if this looks acceptable.

Thanks. That's exactly what I was thinking of. If you send a formal patch I'll be happy to give my RB.

Harry

Quoted 59 lines
drivers/gpu/drm/amd/display/dc/dml/Makefile +9 -5
index 46f9c05de16e..e1d500633dfa 100644
@@ -29,11 +29,15 @@ dml_ccflags := $(CC_FLAGS_FPU)
 dml_rcflags := $(CC_FLAGS_NO_FPU)
 
 ifneq ($(CONFIG_FRAME_WARN),0)
-ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y)
-frame_warn_flag := -Wframe-larger-than=3072
-else
-frame_warn_flag := -Wframe-larger-than=2048
-endif
+    ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y)
+        frame_warn_limit := 3072
+    else
+        frame_warn_limit := 2048
+    endif
+
+    ifeq ($(call test-lt, $(CONFIG_FRAME_WARN), $(frame_warn_limit)),y)
+        frame_warn_flag := -Wframe-larger-than=$(frame_warn_limit)
+    endif
 endif
 
 CFLAGS_$(AMDDALPATH)/dc/dml/display_mode_lib.o := $(dml_ccflags)
drivers/gpu/drm/amd/display/dc/dml2/Makefile +13 -9
index 91c4f3b4bd5f..21fd466dba26 100644
@@ -28,15 +28,19 @@ dml2_ccflags := $(CC_FLAGS_FPU)
 dml2_rcflags := $(CC_FLAGS_NO_FPU)
 
 ifneq ($(CONFIG_FRAME_WARN),0)
-ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y)
-ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_COMPILE_TEST),yy)
-frame_warn_flag := -Wframe-larger-than=4096
-else
-frame_warn_flag := -Wframe-larger-than=3072
-endif
-else
-frame_warn_flag := -Wframe-larger-than=2048
-endif
+    ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y)
+        ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_COMPILE_TEST),yy)
+            frame_warn_limit := 4096
+        else
+            frame_warn_limit := 3072
+        endif
+    else
+        frame_warn_limit := 2048
+    endif
+
+    ifeq ($(call test-lt, $(CONFIG_FRAME_WARN), $(frame_warn_limit)),y)
+        frame_warn_flag := -Wframe-larger-than=$(frame_warn_limit)
+    endif
 endif
 
 subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/dml2