From: Arnd Bergmann <arnd@kernel.org> To: Harry Wentland <harry.wentland@amd.com> Cc: "Nathan Chancellor" <nathan@kernel.org>, "Siqueira, Rodrigo" <Rodrigo.Siqueira@amd.com>, clang-built-linux <llvm@lists.linux.dev>, "David Airlie" <airlied@linux.ie>, "Pan, Xinhui" <Xinhui.Pan@amd.com>, "Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>, "amd-gfx list" <amd-gfx@lists.freedesktop.org>, "Christian König" <christian.koenig@amd.com>, dri-devel <dri-devel@lists.freedesktop.org>, "Alex Deucher" <alexander.deucher@amd.com>, "Linus Torvalds" <torvalds@linux-foundation.org>, "Sudip Mukherjee (Codethink)" <sudipm.mukherjee@gmail.com> Subject: Re: mainline build failure for x86_64 allmodconfig with clang Date: Fri, 5 Aug 2022 18:16:45 +0200 [thread overview] Message-ID: <CAK8P3a3Fv=_+GV9r=k4jP72zZOjJowL-GOue-51EhyVDBaEfEw@mail.gmail.com> (raw) In-Reply-To: <9fb73284-7572-5703-93d3-f83a43535baf@amd.com> On Fri, Aug 5, 2022 at 5:32 PM Harry Wentland <harry.wentland@amd.com> wrote: > > I do notice that these files build with a non-configurable > > -Wframe-large-than value: > > > > $ rg frame_warn_flag drivers/gpu/drm/amd/display/dc/dml/Makefile > > 54:frame_warn_flag := -Wframe-larger-than=2048 > > Tbh, I was looking at the history and I can't find a good reason this > was added. It should be safe to drop this. I would much rather use > the CONFIG_FRAME_WARN value than override it. > > AFAIK most builds use 2048 by default anyways. I'm fairly sure this was done for 32-bit builds, which default to a lower warning limit of 1024 bytes and would otherwise run into this problem when 64-bit platforms don't. With the default warning limit, clang warns even more about an i386 build: display/dc/dml/dcn20/display_rq_dlg_calc_20.c:1549:6: error: stack frame size (1324) exceeds limit (1024) in 'dml20_rq_dlg_get_dlg_reg' display/dc/dml/dcn20/display_rq_dlg_calc_20v2.c:1550:6: error: stack frame size (1324) exceeds limit (1024) in 'dml20v2_rq_dlg_get_dlg_reg' display/dc/dml/dcn30/display_rq_dlg_calc_30.c:1742:6: error: stack frame size (1484) exceeds limit (1024) in 'dml30_rq_dlg_get_dlg_reg' display/dc/dml/dcn31/display_rq_dlg_calc_31.c:1571:6: error: stack frame size (1548) exceeds limit (1024) in 'dml31_rq_dlg_get_dlg_reg' display/dc/dml/dcn21/display_rq_dlg_calc_21.c:1657:6: error: stack frame size (1388) exceeds limit (1024) in 'dml21_rq_dlg_get_dlg_reg' display/dc/dml/dcn32/display_rq_dlg_calc_32.c:206:6: error: stack frame size (1276) exceeds limit (1024) in 'dml32_rq_dlg_get_dlg_reg' display/dc/dml/dcn31/display_mode_vba_31.c:2049:13: error: stack frame size (1468) exceeds limit (1024) in 'DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation' display/dc/dml/dcn20/display_mode_vba_20v2.c:1145:13: error: stack frame size (1228) exceeds limit (1024) in 'dml20v2_DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation' display/dc/dml/dcn20/display_mode_vba_20.c:1085:13: error: stack frame size (1340) exceeds limit (1024) in 'dml20_DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation' display/dc/dml/dcn31/display_mode_vba_31.c:3908:6: error: stack frame size (1996) exceeds limit (1024) in 'dml31_ModeSupportAndSystemConfigurationFull' display/dc/dml/dcn21/display_mode_vba_21.c:1466:13: error: stack frame size (1308) exceeds limit (1024) in 'DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation' display/dc/dml/dcn20/display_mode_vba_20v2.c:3393:6: error: stack frame size (1356) exceeds limit (1024) in 'dml20v2_ModeSupportAndSystemConfigurationFull' display/dc/dml/dcn20/display_mode_vba_20.c:3286:6: error: stack frame size (1468) exceeds limit (1024) in 'dml20_ModeSupportAndSystemConfigurationFull' display/dc/dml/dcn21/display_mode_vba_21.c:3518:6: error: stack frame size (1228) exceeds limit (1024) in 'dml21_ModeSupportAndSystemConfigurationFull' display/dc/dml/dcn30/display_mode_vba_30.c:1906:13: error: stack frame size (1436) exceeds limit (1024) in 'DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation' display/dc/dml/dcn30/display_mode_vba_30.c:3596:6: error: stack frame size (2092) exceeds limit (1024) in 'dml30_ModeSupportAndSystemConfigurationFull' > > I do note that commit 1b54a0121dba ("drm/amd/display: Reduce stack size > > in the mode support function") did have a workaround for GCC. It appears > > clang will still inline mode_support_configuration(). If I mark it as > > 'noinline', the warning disappears in that file. > > That'd be the best quick fix. I guess if we split out functions to fix > stack usage we should mark them as 'noinline' in the future to avoid > agressive compiler optimizations. While splitting out sub-functions can help reduce the maximum stack usage, it seems that in this case it makes the actual problem worse: I see 2168 bytes for the combined dml32_ModeSupportAndSystemConfigurationFull(), but marking mode_support_configuration() as noinline gives me 1992 bytes for the outer function plus 384 bytes for the inner one. So it does avoid the warning (barely), but not the problem that the warning tries to point out. Arnd
WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd@kernel.org> To: Harry Wentland <harry.wentland@amd.com> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>, "David Airlie" <airlied@linux.ie>, clang-built-linux <llvm@lists.linux.dev>, "Siqueira, Rodrigo" <Rodrigo.Siqueira@amd.com>, "Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>, "amd-gfx list" <amd-gfx@lists.freedesktop.org>, "Sudip Mukherjee (Codethink)" <sudipm.mukherjee@gmail.com>, "Nathan Chancellor" <nathan@kernel.org>, dri-devel <dri-devel@lists.freedesktop.org>, "Alex Deucher" <alexander.deucher@amd.com>, "Linus Torvalds" <torvalds@linux-foundation.org>, "Christian König" <christian.koenig@amd.com> Subject: Re: mainline build failure for x86_64 allmodconfig with clang Date: Fri, 5 Aug 2022 18:16:45 +0200 [thread overview] Message-ID: <CAK8P3a3Fv=_+GV9r=k4jP72zZOjJowL-GOue-51EhyVDBaEfEw@mail.gmail.com> (raw) In-Reply-To: <9fb73284-7572-5703-93d3-f83a43535baf@amd.com> On Fri, Aug 5, 2022 at 5:32 PM Harry Wentland <harry.wentland@amd.com> wrote: > > I do notice that these files build with a non-configurable > > -Wframe-large-than value: > > > > $ rg frame_warn_flag drivers/gpu/drm/amd/display/dc/dml/Makefile > > 54:frame_warn_flag := -Wframe-larger-than=2048 > > Tbh, I was looking at the history and I can't find a good reason this > was added. It should be safe to drop this. I would much rather use > the CONFIG_FRAME_WARN value than override it. > > AFAIK most builds use 2048 by default anyways. I'm fairly sure this was done for 32-bit builds, which default to a lower warning limit of 1024 bytes and would otherwise run into this problem when 64-bit platforms don't. With the default warning limit, clang warns even more about an i386 build: display/dc/dml/dcn20/display_rq_dlg_calc_20.c:1549:6: error: stack frame size (1324) exceeds limit (1024) in 'dml20_rq_dlg_get_dlg_reg' display/dc/dml/dcn20/display_rq_dlg_calc_20v2.c:1550:6: error: stack frame size (1324) exceeds limit (1024) in 'dml20v2_rq_dlg_get_dlg_reg' display/dc/dml/dcn30/display_rq_dlg_calc_30.c:1742:6: error: stack frame size (1484) exceeds limit (1024) in 'dml30_rq_dlg_get_dlg_reg' display/dc/dml/dcn31/display_rq_dlg_calc_31.c:1571:6: error: stack frame size (1548) exceeds limit (1024) in 'dml31_rq_dlg_get_dlg_reg' display/dc/dml/dcn21/display_rq_dlg_calc_21.c:1657:6: error: stack frame size (1388) exceeds limit (1024) in 'dml21_rq_dlg_get_dlg_reg' display/dc/dml/dcn32/display_rq_dlg_calc_32.c:206:6: error: stack frame size (1276) exceeds limit (1024) in 'dml32_rq_dlg_get_dlg_reg' display/dc/dml/dcn31/display_mode_vba_31.c:2049:13: error: stack frame size (1468) exceeds limit (1024) in 'DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation' display/dc/dml/dcn20/display_mode_vba_20v2.c:1145:13: error: stack frame size (1228) exceeds limit (1024) in 'dml20v2_DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation' display/dc/dml/dcn20/display_mode_vba_20.c:1085:13: error: stack frame size (1340) exceeds limit (1024) in 'dml20_DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation' display/dc/dml/dcn31/display_mode_vba_31.c:3908:6: error: stack frame size (1996) exceeds limit (1024) in 'dml31_ModeSupportAndSystemConfigurationFull' display/dc/dml/dcn21/display_mode_vba_21.c:1466:13: error: stack frame size (1308) exceeds limit (1024) in 'DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation' display/dc/dml/dcn20/display_mode_vba_20v2.c:3393:6: error: stack frame size (1356) exceeds limit (1024) in 'dml20v2_ModeSupportAndSystemConfigurationFull' display/dc/dml/dcn20/display_mode_vba_20.c:3286:6: error: stack frame size (1468) exceeds limit (1024) in 'dml20_ModeSupportAndSystemConfigurationFull' display/dc/dml/dcn21/display_mode_vba_21.c:3518:6: error: stack frame size (1228) exceeds limit (1024) in 'dml21_ModeSupportAndSystemConfigurationFull' display/dc/dml/dcn30/display_mode_vba_30.c:1906:13: error: stack frame size (1436) exceeds limit (1024) in 'DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation' display/dc/dml/dcn30/display_mode_vba_30.c:3596:6: error: stack frame size (2092) exceeds limit (1024) in 'dml30_ModeSupportAndSystemConfigurationFull' > > I do note that commit 1b54a0121dba ("drm/amd/display: Reduce stack size > > in the mode support function") did have a workaround for GCC. It appears > > clang will still inline mode_support_configuration(). If I mark it as > > 'noinline', the warning disappears in that file. > > That'd be the best quick fix. I guess if we split out functions to fix > stack usage we should mark them as 'noinline' in the future to avoid > agressive compiler optimizations. While splitting out sub-functions can help reduce the maximum stack usage, it seems that in this case it makes the actual problem worse: I see 2168 bytes for the combined dml32_ModeSupportAndSystemConfigurationFull(), but marking mode_support_configuration() as noinline gives me 1992 bytes for the outer function plus 384 bytes for the inner one. So it does avoid the warning (barely), but not the problem that the warning tries to point out. Arnd
next prev parent reply other threads:[~2022-08-05 16:17 UTC|newest] Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-08-04 18:36 mainline build failure for x86_64 allmodconfig with clang Sudip Mukherjee (Codethink) 2022-08-04 18:36 ` Sudip Mukherjee (Codethink) 2022-08-04 18:36 ` Sudip Mukherjee (Codethink) 2022-08-04 18:52 ` Linus Torvalds 2022-08-04 18:52 ` Linus Torvalds 2022-08-04 18:52 ` Linus Torvalds 2022-08-04 19:24 ` Arnd Bergmann 2022-08-04 19:24 ` Arnd Bergmann 2022-08-04 19:24 ` Arnd Bergmann 2022-08-04 20:43 ` Nathan Chancellor 2022-08-04 20:43 ` Nathan Chancellor 2022-08-04 20:43 ` Nathan Chancellor 2022-08-04 21:59 ` Linus Torvalds 2022-08-04 21:59 ` Linus Torvalds 2022-08-04 21:59 ` Linus Torvalds 2022-08-04 22:43 ` Nathan Chancellor 2022-08-04 22:43 ` Nathan Chancellor 2022-08-04 22:43 ` Nathan Chancellor 2022-08-05 9:46 ` David Laight 2022-08-05 9:46 ` David Laight 2022-08-05 9:46 ` David Laight 2022-08-05 15:32 ` Harry Wentland 2022-08-05 15:32 ` Harry Wentland 2022-08-05 16:16 ` Arnd Bergmann [this message] 2022-08-05 16:16 ` Arnd Bergmann 2022-08-05 18:02 ` Nathan Chancellor 2022-08-05 18:02 ` Nathan Chancellor 2022-08-05 18:02 ` Nathan Chancellor 2022-08-05 19:32 ` Arnd Bergmann 2022-08-05 19:32 ` Arnd Bergmann 2022-08-05 19:32 ` Arnd Bergmann 2022-08-07 17:36 ` David Laight 2022-08-07 17:36 ` David Laight 2022-08-07 17:36 ` David Laight 2022-08-07 17:55 ` Linus Torvalds 2022-08-07 17:55 ` Linus Torvalds 2022-08-07 17:55 ` Linus Torvalds 2022-08-18 15:59 ` Nathan Chancellor 2022-08-18 15:59 ` Nathan Chancellor 2022-08-25 22:34 ` Nathan Chancellor 2022-08-25 22:34 ` Nathan Chancellor 2022-08-26 14:31 ` Alex Deucher 2022-08-26 14:31 ` Alex Deucher 2022-08-26 14:31 ` Alex Deucher 2022-08-30 20:38 ` Nathan Chancellor 2022-08-30 20:38 ` Nathan Chancellor 2022-08-30 20:38 ` Nathan Chancellor
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to='CAK8P3a3Fv=_+GV9r=k4jP72zZOjJowL-GOue-51EhyVDBaEfEw@mail.gmail.com' \ --to=arnd@kernel.org \ --cc=Rodrigo.Siqueira@amd.com \ --cc=Xinhui.Pan@amd.com \ --cc=airlied@linux.ie \ --cc=alexander.deucher@amd.com \ --cc=amd-gfx@lists.freedesktop.org \ --cc=christian.koenig@amd.com \ --cc=dri-devel@lists.freedesktop.org \ --cc=harry.wentland@amd.com \ --cc=linux-kernel@vger.kernel.org \ --cc=llvm@lists.linux.dev \ --cc=nathan@kernel.org \ --cc=sudipm.mukherjee@gmail.com \ --cc=torvalds@linux-foundation.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.