mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/amd/display: Respect user's CONFIG_FRAME_WARN more for dml files
@ 2025-01-31 22:31 Nathan Chancellor
  2025-02-03 20:06 ` Alex Deucher
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Chancellor @ 2025-01-31 22:31 UTC (permalink / raw)
  To: Jun Lei, Harry Wentland, Leo Li, Rodrigo Siqueira, Alex Deucher,
	Christian König
  Cc: amd-gfx, dri-devel, linux-kernel, Greg Kroah-Hartman, Nathan Chancellor

Currently, there are several files in drm/amd/display that aim to have a
higher -Wframe-larger-than value to avoid instances of that warning with
a lower value from the user's configuration. However, with the way that
it is currently implemented, it does not respect the user's request via
CONFIG_FRAME_WARN for a higher stack frame limit, which can cause pain
when new instances of the warning appear and break the build due to
CONFIG_WERROR.

Adjust the logic to switch from a hard coded -Wframe-larger-than value
to only using the value as a minimum clamp and deferring to the
requested value from CONFIG_FRAME_WARN if it is higher.

Suggested-by: Harry Wentland <harry.wentland@amd.com>
Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Closes: https://lore.kernel.org/2025013003-audience-opposing-7f95@gregkh/
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 drivers/gpu/drm/amd/display/dc/dml/Makefile  | 14 +++++++++-----
 drivers/gpu/drm/amd/display/dc/dml2/Makefile | 22 +++++++++++++---------
 2 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dml/Makefile b/drivers/gpu/drm/amd/display/dc/dml/Makefile
index 46f9c05de16e8c9035f9e26c0b5c481c274d52ef..e1d500633dfad75e4f2265552be42a3e19dee6bf 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/dml/Makefile
@@ -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)
diff --git a/drivers/gpu/drm/amd/display/dc/dml2/Makefile b/drivers/gpu/drm/amd/display/dc/dml2/Makefile
index 91c4f3b4bd5f46ac5c1c74f665b06dbe61081917..21fd466dba26ef3359196d0b26bc29125bb1507a 100644
--- a/drivers/gpu/drm/amd/display/dc/dml2/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/dml2/Makefile
@@ -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

---
base-commit: 7f2b5237e313e39008a85b33ca94ab503a8fdff9
change-id: 20250131-amdgpu-respect-config_frame_warn-739a9b24496e

Best regards,
-- 
Nathan Chancellor <nathan@kernel.org>


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/amd/display: Respect user's CONFIG_FRAME_WARN more for dml files
  2025-01-31 22:31 [PATCH] drm/amd/display: Respect user's CONFIG_FRAME_WARN more for dml files Nathan Chancellor
@ 2025-02-03 20:06 ` Alex Deucher
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Deucher @ 2025-02-03 20:06 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Jun Lei, Harry Wentland, Leo Li, Rodrigo Siqueira, Alex Deucher,
	Christian König, amd-gfx, dri-devel, linux-kernel,
	Greg Kroah-Hartman

Applied.  Thanks!

Alex

On Fri, Jan 31, 2025 at 5:38 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> Currently, there are several files in drm/amd/display that aim to have a
> higher -Wframe-larger-than value to avoid instances of that warning with
> a lower value from the user's configuration. However, with the way that
> it is currently implemented, it does not respect the user's request via
> CONFIG_FRAME_WARN for a higher stack frame limit, which can cause pain
> when new instances of the warning appear and break the build due to
> CONFIG_WERROR.
>
> Adjust the logic to switch from a hard coded -Wframe-larger-than value
> to only using the value as a minimum clamp and deferring to the
> requested value from CONFIG_FRAME_WARN if it is higher.
>
> Suggested-by: Harry Wentland <harry.wentland@amd.com>
> Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Closes: https://lore.kernel.org/2025013003-audience-opposing-7f95@gregkh/
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
>  drivers/gpu/drm/amd/display/dc/dml/Makefile  | 14 +++++++++-----
>  drivers/gpu/drm/amd/display/dc/dml2/Makefile | 22 +++++++++++++---------
>  2 files changed, 22 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dml/Makefile b/drivers/gpu/drm/amd/display/dc/dml/Makefile
> index 46f9c05de16e8c9035f9e26c0b5c481c274d52ef..e1d500633dfad75e4f2265552be42a3e19dee6bf 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml/Makefile
> +++ b/drivers/gpu/drm/amd/display/dc/dml/Makefile
> @@ -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)
> diff --git a/drivers/gpu/drm/amd/display/dc/dml2/Makefile b/drivers/gpu/drm/amd/display/dc/dml2/Makefile
> index 91c4f3b4bd5f46ac5c1c74f665b06dbe61081917..21fd466dba26ef3359196d0b26bc29125bb1507a 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml2/Makefile
> +++ b/drivers/gpu/drm/amd/display/dc/dml2/Makefile
> @@ -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
>
> ---
> base-commit: 7f2b5237e313e39008a85b33ca94ab503a8fdff9
> change-id: 20250131-amdgpu-respect-config_frame_warn-739a9b24496e
>
> Best regards,
> --
> Nathan Chancellor <nathan@kernel.org>
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-02-03 20:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-31 22:31 [PATCH] drm/amd/display: Respect user's CONFIG_FRAME_WARN more for dml files Nathan Chancellor
2025-02-03 20:06 ` Alex Deucher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®