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

Harry Wentland harry.wentland at amd.com
Thu Jan 30 19:16:25 UTC 2025



On 2025-01-30 12:51, Nathan Chancellor wrote:
> Hey Greg and Harry,
> 

[snip]

>> 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.

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

Harry

> 
> diff --git a/drivers/gpu/drm/amd/display/dc/dml/Makefile b/drivers/gpu/drm/amd/display/dc/dml/Makefile
> index 46f9c05de16e..e1d500633dfa 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 91c4f3b4bd5f..21fd466dba26 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



More information about the dri-devel mailing list