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=x86-64 #1754

Closed
ms178 opened this issue Nov 2, 2022 · 13 comments
Labels
-Wframe-larger-than= [ARCH] x86_64 This bug impacts ARCH=x86_64

Comments

@ms178
Copy link

ms178 commented Nov 2, 2022

I see similar warnings as posted in #1752 with my x86-64-build of a 6.0.6 Kernel with some patches (more details and config 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

That was seen with FullLTO, my custom LLVM-Toolchain from my repo and clang version 16.0.0 (c97035c49d941e5b196a938f0393f811d1adbd57).

@ms178 ms178 added -Wframe-larger-than= [ARCH] x86_64 This bug impacts ARCH=x86_64 labels Nov 2, 2022
@nathanchance
Copy link
Member

I would be curious to know if the same configuration without LTO shows the same warnings. Based on the variables to spill ratio, it is possible that LTO does more inlining and blows out the stack.

@ms178
Copy link
Author

ms178 commented Nov 2, 2022

Without LTO, I've just noticed these two:

drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn31/display_mode_vba_31.c:3767:6: warning: stack frame size (2680) exceeds limit (2048) in 'dml31_ModeSupportAndSystemConfigurationFull' [-Wframe-larger-than]
void dml31_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_lib)
     ^
1387/2680 (51.75%) spills, 1293/2680 (48.25%) variables
 
drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn314/display_mode_vba_314.c:3890:6: warning: stack frame size (2584) exceeds limit (2048) in 'dml314_ModeSupportAndSystemConfigurationFull' [-Wframe-larger-than]
void dml314_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_lib)
     ^
1355/2584 (52.44%) spills, 1229/2584 (47.56%) variables

@ms178
Copy link
Author

ms178 commented Dec 15, 2022

This is what I get with Kernel 6.1 and Clang-16 (23e3e107dceb1fd8c1fb81d1229f6aab09a1fce2):

 LD [M]  drivers/gpu/drm/amd/amdgpu/amdgpu.o
ld.lld: warning: <unknown>:0:0: stack frame size (3032) exceeds limit (2048) in function 'dml31_ModeSupportAndSystemConfigurationFull'
2055/3032 (67.78%) spills, 977/3032 (32.22%) variables
ld.lld: warning: <unknown>:0:0: stack frame size (3000) exceeds limit (2048) in function 'dml314_ModeSupportAndSystemConfigurationFull'
2051/3000 (68.37%) spills, 949/3000 (31.63%) variables
ld.lld: warning: <unknown>:0:0: stack frame size (2072) exceeds limit (2048) in function 'dml32_CalculateVMRowAndSwath'
1554/2072 (75.00%) spills, 518/2072 (25.00%) variables

@dileks
Copy link
Collaborator

dileks commented Jan 17, 2023

With Linux 6.2-rc4 and LLVM 15.0.3 I still see:

ld.lld: warning: stack frame size (2088) exceeds limit (2048) in function 'dml314_ModeSupportAndSystemConfigurationFull'
ld.lld: warning: stack frame size (2088) exceeds limit (2048) in function 'dml31_ModeSupportAndSystemConfigurationFull'

kernel-config: ThinLTO + KCFI

@nathanchance
Copy link
Member

This series might address those warnings:

https://lore.kernel.org/20230110154325.3350916-1-Rodrigo.Siqueira@amd.com/

@dileks
Copy link
Collaborator

dileks commented Jan 17, 2023

@nathanchance

Thanks for the link.

The patch-series applies cleanly on top of Linux 6.2-rc4.

@dileks
Copy link
Collaborator

dileks commented Jan 18, 2023

@nathanchance @rodrigosiqueira

A big thank-you pointing me to the link and Rodrigo Siqueira Rodrigo.Siqueira@amd.com for the patch-set.

I did a new build including this patch-set and this fixes the warnings for me.

Here and formally (patch-series on top of Linux v6.2-rc4):

Tested-by: Sedat Dilek sedat.dilek@gmail.com # LLVM-15.0.3 x86-64

@ms178
Copy link
Author

ms178 commented Jan 18, 2023

I can confirm that the warnings are gone with that patchset and clang version 16.0.0 (60b98979241151f8d6ec8af9ebc4da421f4a0258), using FullLTO and x86-64 on my modified Kernel 6.1.7.

Tested-by: Marcus Seyfarth m.seyfarth@gmail.com

@dileks
Copy link
Collaborator

dileks commented Jan 29, 2023

Unfortunately - patchset applied on top of Linux v6.2-rc5+ - with LLVM 16.0.0-rc1 (stage1-only) I see again:

27616:ld.lld: warning: drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn314/display_mode_vba_314.c:3890:0: stack frame size (2056) exceeds limit (2048) in function 'dml314_ModeSupportAndSystemConfigurationFull'
27622:ld.lld: warning: drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn31/display_mode_vba_31.c:3791:0: stack frame size (2120) exceeds limit (2048) in function 'dml31_ModeSupportAndSystemConfigurationFull'

config-6.2.0-rc5-2-amd64-clang16-kcfi.txt

@nathanchance
Copy link
Member

I suspect this series that was just sent out will resolve this issue.

@nickdesaulniers
Copy link
Member

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)

@ms178
Copy link
Author

ms178 commented Aug 17, 2023

@nickdesaulniers I've been carrying the following series with my Kernel that addresses this issue to some degree: https://lists.freedesktop.org/archives/amd-gfx/2023-January/088203.html

Will there be a backport of your patch for LLVM/Clang-17 or a point release? As we are still in the RC phase, it might be still possible to land this for the Clang-17 release?

@nickdesaulniers
Copy link
Member

nickdesaulniers commented Aug 17, 2023

https://reviews.llvm.org/rGe698695fbbf62e6676f8907665187f2d2c4d814b has already been reverted once.

I relanded it without any hint to whatever was the matter with it the first time (possibly nothing; it may have been exposing an older issue that's since been found+fixed). So I'm still holding my breath that it will stick and not get reverted a second time. As such, I consider it too high risk to backport; I'd like it to bake longer to ensure it sticks.

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

No branches or pull requests

4 participants