Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-Wframe-larger-than instances in drivers/gpu/drm/amd/display/dc/dml with ARCH=arm64 #1752

Closed
nathanchance opened this issue Oct 31, 2022 · 9 comments
Labels
-Wframe-larger-than= [ARCH] arm64 This bug impacts ARCH=arm64

Comments

@nathanchance
Copy link
Member

An in-progress change is going to turn on the files that were problematic for x86 (#1681) for arm64 as well, which will show new warnings for allmodconfig:

drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn30/display_mode_vba_30.c:1852:13: error: stack frame size (2112) exceeds limit (2048) in 'DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation' [-Werror,-Wframe-larger-than]
static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation(
            ^
1152/2112 (54.55%) spills, 960/2112 (45.45%) variables

drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn30/display_mode_vba_30.c:3542:6: error: stack frame size (2240) exceeds limit (2048) in 'dml30_ModeSupportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than]
void dml30_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_lib)
    ^
1451/2240 (64.78%) spills, 789/2240 (35.22%) variables

drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn31/display_mode_vba_31.c:3791:6: error: stack frame size (2736) exceeds limit (2048) in 'dml31_ModeSupportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than]
void dml31_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_lib)
    ^
1342/2736 (49.05%) spills, 1394/2736 (50.95%) variables

drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn314/display_mode_vba_314.c:3890:6: error: stack frame size (2720) exceeds limit (2048) in 'dml314_ModeSupportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than]
void dml314_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_lib)
    ^
1325/2720 (48.71%) spills, 1395/2720 (51.29%) variables

drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn32/display_mode_vba_32.c:59:13: error: stack frame size (2208) exceeds limit (2048) in 'DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation' [-Werror,-Wframe-larger-than]
static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation(
            ^
1397/2208 (63.27%) spills, 811/2208 (36.73%) variables

drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn32/display_mode_vba_32.c:1681:6: error: stack frame size (2496) exceeds limit (2048) in 'dml32_ModeSupportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than]
void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_lib)
    ^
1504/2496 (60.26%) spills, 992/2496 (39.74%) variables

This will require further investigation and I would rather not hold up the patch just for that so I am going to recommend that this enablement be gated on !CC_IS_CLANG to allow us to figure out what is going on out of band.

@nathanchance nathanchance added [ARCH] arm64 This bug impacts ARCH=arm64 low priority This bug is not critical and not a priority -Wframe-larger-than= labels Oct 31, 2022
@nathanchance
Copy link
Member Author

v4 has included a condition to avoid these warnings by not enabling the problematic code when building with clang.

https://lore.kernel.org/20221031193738.23538-2-hacc1225@gmail.com/

Once this patch is in the tree with that bit, it will have to be removed to investigate this issue (basically reverse this diff). Just notating that in case we do a bug scrub in the future, people do not try to close this because they cannot reproduce the issue :)

Additionally, anyone is free to investigate this, should they come across this issue from the source tree or other means.

@ms178
Copy link

ms178 commented Nov 2, 2022

@nathanchance

I see similar warnings in my X86-build of a 6.0.6 Kernel with some patches (get them here):

LD [M]  drivers/gpu/drm/amd/amdgpu/amdgpu.o
ld.lld: warning: <unknown>:0:0: stack frame size (2808) exceeds limit (2048) in function 'dml31_ModeSupportAndSystemConfigurationFull'
1638/2808 (58.33%) spills, 1170/2808 (41.67%) variables
ld.lld: warning: <unknown>:0:0: stack frame size (2808) exceeds limit (2048) in function 'dml314_ModeSupportAndSystemConfigurationFull'
1638/2808 (58.33%) spills, 1170/2808 (41.67%) variables

@dileks
Copy link
Collaborator

dileks commented Nov 2, 2022

/me too see these warning with x86-64 and selfmade LLVM-15.0.3 (ThinLTO + PGO optimized - KCFI sanitizer).

$ grep warning: build-log_6.0.6-1-amd64-clang15-kcfi.txt 
156:dpkg-architecture: warning: specified GNU system type x86_64-linux-gnu does not match CC system type x86_64-pc-linux-gnu, try setting a correct CC environment variable
27971:ld.lld: warning: stack frame size (2072) exceeds limit (2048) in function 'dml314_ModeSupportAndSystemConfigurationFull'
27980:ld.lld: warning: stack frame size (2056) exceeds limit (2048) in function 'dml31_ModeSupportAndSystemConfigurationFull'

My kernel-config is attached.

Note: I reported this already via PM.

config-6.0.6-1-amd64-clang15-kcfi.txt

@nathanchance
Copy link
Member Author

Please open a new issue for those instances, as they are likely related to LTO, given they are coming from ld.lld. This issue is purely for tracking the warnings seen on arm64.

@nickdesaulniers
Copy link
Member

nickdesaulniers commented Aug 17, 2023

Also, clang-18 has some improvements around stack usage.
https://reviews.llvm.org/rGe698695fbbf62e6676f8907665187f2d2c4d814b

Since it's not clear to me from this thread what fixed this where (and I can no longer reproduce w/ clang-18), closing.

Please reopen with more info if you can reproduce with clang-18+ (containing https://reviews.llvm.org/rGe698695fbbf62e6676f8907665187f2d2c4d814b)

@nickdesaulniers
Copy link
Member

Reopening to track partially reverting
commit 79b72db ("drm/amd/display: add DCN support for ARM64")

@nickdesaulniers nickdesaulniers self-assigned this Aug 17, 2023
@nickdesaulniers nickdesaulniers removed the low priority This bug is not critical and not a priority label Aug 17, 2023
@nathanchance
Copy link
Member Author

nathanchance commented Aug 17, 2023

Did you apply this when testing?

diff --git a/drivers/gpu/drm/amd/display/Kconfig b/drivers/gpu/drm/amd/display/Kconfig
index bf0a655d009e..7abdfcaaaca1 100644
--- a/drivers/gpu/drm/amd/display/Kconfig
+++ b/drivers/gpu/drm/amd/display/Kconfig
@@ -8,7 +8,7 @@ config DRM_AMD_DC
        depends on BROKEN || !CC_IS_CLANG || X86_64 || SPARC64 || ARM64
        select SND_HDA_COMPONENT if SND_HDA_CORE
        # !CC_IS_CLANG: https://github.com/ClangBuiltLinux/linux/issues/1752
-       select DRM_AMD_DC_FP if (X86 || LOONGARCH || (PPC64 && ALTIVEC) || (ARM64 && KERNEL_MODE_NEON && !CC_IS_CLANG))
+       select DRM_AMD_DC_FP if (X86 || LOONGARCH || (PPC64 && ALTIVEC) || (ARM64 && KERNEL_MODE_NEON))
        help
          Choose this option if you want to use the new display engine
          support for AMDGPU. This adds required support for Vega and

because I still see

drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn32/display_mode_vba_32.c:58:13: error: stack frame size (2272) exceeds limit (2048) in 'DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation' [-Werror,-Wframe-larger-than]
   58 | static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation(
      |             ^
drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn32/display_mode_vba_32.c:1722:6: error: stack frame size (2384) exceeds limit (2048) in 'dml32_ModeSupportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than]
 1722 | void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_lib)
      |      ^
2 errors generated.

with clang-18 at llvm/llvm-project@2628fa3, which has llvm/llvm-project@e698695, when building ARCH=arm64 allmodconfig.

@nickdesaulniers
Copy link
Member

Ah, you're right.

@nickdesaulniers
Copy link
Member

duplicating this to #39. Once the two issues identified by #39 (comment) are fixed in clang, we can reopen this if necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-Wframe-larger-than= [ARCH] arm64 This bug impacts ARCH=arm64
Projects
None yet
Development

No branches or pull requests

4 participants