Commit a8d42cd
drm/amd/display: mark static functions noinline_for_stack
When compiling allmodconfig (CONFIG_WERROR=y) with clang-19, see the
following errors:
.../display/dc/dml2/display_mode_core.c:6268:13: warning: stack frame size (3128) exceeds limit (3072) in 'dml_prefetch_check' [-Wframe-larger-than]
.../display/dc/dml2/dml21/src/dml2_core/dml2_core_dcn4_calcs.c:7236:13: warning: stack frame size (3256) exceeds limit (3072) in 'dml_core_mode_support' [-Wframe-larger-than]
Mark static functions called by dml_prefetch_check() and
dml_core_mode_support() noinline_for_stack to avoid them become huge
functions and thus exceed the frame size limit.
A way to reproduce:
$ git checkout next-20250107
$ mkdir build_dir
$ export PATH=/tmp/llvm-19.1.6-x86_64/bin:$PATH
$ make LLVM=1 O=build_dir allmodconfig
$ make LLVM=1 O=build_dir drivers/gpu/drm/ -j
The way how it chose static functions to mark:
[0] Unset CONFIG_WERROR in build_dir/.config.
To get display_mode_core.o without errors.
[1] Get a function list called by dml_prefetch_check().
$ sed -n '6268,6711p' drivers/gpu/drm/amd/display/dc/dml2/display_mode_core.c \
| sed -n -r 's/.*\W(\w+)\(.*/\1/p' | sort -u >/tmp/syms
[2] Get the non-inline function list.
Objdump won't show the symbols if they are inline functions.
$ make LLVM=1 O=build_dir drivers/gpu/drm/ -j
$ objdump -d build_dir/.../display_mode_core.o | \
./scripts/checkstack.pl x86_64 0 | \
grep -f /tmp/syms | cut -d' ' -f2- >/tmp/orig
[3] Get the full function list.
Append "-fno-inline" to `CFLAGS_.../display_mode_core.o` in
drivers/gpu/drm/amd/display/dc/dml2/Makefile.
$ make LLVM=1 O=build_dir drivers/gpu/drm/ -j
$ objdump -d build_dir/.../display_mode_core.o | \
./scripts/checkstack.pl x86_64 0 | \
grep -f /tmp/syms | cut -d' ' -f2- >/tmp/noinline
[4] Get the inline function list.
If a symbol only in /tmp/noinline but not in /tmp/orig, it is a good
candidate to mark noinline.
$ diff /tmp/orig /tmp/noinline
Chosen functions and their stack sizes:
CalculateBandwidthAvailableForImmediateFlip [display_mode_core.o]:144
CalculateExtraLatency [display_mode_core.o]:176
CalculateTWait [display_mode_core.o]:64
CalculateVActiveBandwithSupport [display_mode_core.o]:112
set_calculate_prefetch_schedule_params [display_mode_core.o]:48
CheckGlobalPrefetchAdmissibility [dml2_core_dcn4_calcs.o]:544
calculate_bandwidth_available [dml2_core_dcn4_calcs.o]:320
calculate_vactive_det_fill_latency [dml2_core_dcn4_calcs.o]:272
CalculateDCFCLKDeepSleep [dml2_core_dcn4_calcs.o]:208
CalculateODMMode [dml2_core_dcn4_calcs.o]:208
CalculateOutputLink [dml2_core_dcn4_calcs.o]:176
Signed-off-by: Tzung-Bi Shih <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>1 parent 1241b64 commit a8d42cd
File tree
2 files changed
+12
-12
lines changed- drivers/gpu/drm/amd/display/dc/dml2
- dml21/src/dml2_core
2 files changed
+12
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1736 | 1736 | | |
1737 | 1737 | | |
1738 | 1738 | | |
1739 | | - | |
| 1739 | + | |
1740 | 1740 | | |
1741 | 1741 | | |
1742 | 1742 | | |
| |||
4458 | 4458 | | |
4459 | 4459 | | |
4460 | 4460 | | |
4461 | | - | |
| 4461 | + | |
4462 | 4462 | | |
4463 | 4463 | | |
4464 | 4464 | | |
| |||
5915 | 5915 | | |
5916 | 5916 | | |
5917 | 5917 | | |
5918 | | - | |
| 5918 | + | |
5919 | 5919 | | |
5920 | 5920 | | |
5921 | 5921 | | |
| |||
6019 | 6019 | | |
6020 | 6020 | | |
6021 | 6021 | | |
6022 | | - | |
| 6022 | + | |
6023 | 6023 | | |
6024 | 6024 | | |
6025 | 6025 | | |
| |||
6213 | 6213 | | |
6214 | 6214 | | |
6215 | 6215 | | |
6216 | | - | |
| 6216 | + | |
6217 | 6217 | | |
6218 | 6218 | | |
6219 | 6219 | | |
| |||
6265 | 6265 | | |
6266 | 6266 | | |
6267 | 6267 | | |
6268 | | - | |
| 6268 | + | |
6269 | 6269 | | |
6270 | 6270 | | |
6271 | 6271 | | |
| |||
Lines changed: 6 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2778 | 2778 | | |
2779 | 2779 | | |
2780 | 2780 | | |
2781 | | - | |
| 2781 | + | |
2782 | 2782 | | |
2783 | 2783 | | |
2784 | 2784 | | |
| |||
3625 | 3625 | | |
3626 | 3626 | | |
3627 | 3627 | | |
3628 | | - | |
| 3628 | + | |
3629 | 3629 | | |
3630 | 3630 | | |
3631 | 3631 | | |
| |||
4142 | 4142 | | |
4143 | 4143 | | |
4144 | 4144 | | |
4145 | | - | |
| 4145 | + | |
4146 | 4146 | | |
4147 | 4147 | | |
4148 | 4148 | | |
| |||
4239 | 4239 | | |
4240 | 4240 | | |
4241 | 4241 | | |
4242 | | - | |
| 4242 | + | |
4243 | 4243 | | |
4244 | 4244 | | |
4245 | 4245 | | |
| |||
5999 | 5999 | | |
6000 | 6000 | | |
6001 | 6001 | | |
6002 | | - | |
| 6002 | + | |
6003 | 6003 | | |
6004 | 6004 | | |
6005 | 6005 | | |
| |||
7012 | 7012 | | |
7013 | 7013 | | |
7014 | 7014 | | |
7015 | | - | |
| 7015 | + | |
7016 | 7016 | | |
7017 | 7017 | | |
7018 | 7018 | | |
| |||
0 commit comments