All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Fix stack usage of DML
@ 2021-09-09  0:30 Harry Wentland
  0 siblings, 0 replies; 5+ messages in thread
From: Harry Wentland @ 2021-09-09  0:30 UTC (permalink / raw)
  To: amd-gfx
  Cc: ndesaulniers, torvalds, linux-kernel, arnd, sunpeng.li,
	alexander.deucher, christian.koenig, Xinhui.Pan, nathan, linux,
	llvm, Harry Wentland

With the '-Werror' enablement patch the amdgpu build was failing
on clang builds because a bunch of functions were blowing past
the 1024 byte stack frame default. Due to this we also noticed
that a lot of functions were passing large structs by value
instead of by pointer.

This series attempts to fix this.

There is still one remaining function that blows the 1024 limit by 40 bytes:

drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn21/display_mode_vba_21.c:3397:6: 
error: stack frame size of 1064 bytes in function 
'dml21_ModeSupportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than=]

This will be a slightly more challenging fix but I'll see if we can get it
below 1024 by breaking it into smaller functions.

With this series I can build amdgpu with CC=clang and a stack frame limit of 
1064.

This series boots on a Radeon RX 5500 XT.

Harry Wentland (4):
  drm/amd/display: Pass display_pipe_params_st as const in DML
  drm/amd/display: Pass all structs in display_rq_dlg_helpers by pointer
  drm/amd/display: Fix rest of pass-by-value structs in DML
  drm/amd/display: Allocate structs needed by dcn_bw_calc_rq_dlg_ttu in
    pipe_ctx

 .../gpu/drm/amd/display/dc/calcs/dcn_calcs.c  |  55 ++--
 .../drm/amd/display/dc/dcn20/dcn20_resource.c |   2 +-
 .../dc/dml/dcn20/display_rq_dlg_calc_20.c     | 158 +++++------
 .../dc/dml/dcn20/display_rq_dlg_calc_20.h     |   4 +-
 .../dc/dml/dcn20/display_rq_dlg_calc_20v2.c   | 156 +++++------
 .../dc/dml/dcn20/display_rq_dlg_calc_20v2.h   |   4 +-
 .../dc/dml/dcn21/display_rq_dlg_calc_21.c     | 156 +++++------
 .../dc/dml/dcn21/display_rq_dlg_calc_21.h     |   4 +-
 .../dc/dml/dcn30/display_rq_dlg_calc_30.c     | 132 ++++-----
 .../dc/dml/dcn30/display_rq_dlg_calc_30.h     |   4 +-
 .../dc/dml/dcn31/display_rq_dlg_calc_31.c     | 166 ++++++------
 .../dc/dml/dcn31/display_rq_dlg_calc_31.h     |   4 +-
 .../drm/amd/display/dc/dml/display_mode_lib.h |   4 +-
 .../display/dc/dml/display_rq_dlg_helpers.c   | 256 +++++++++---------
 .../display/dc/dml/display_rq_dlg_helpers.h   |  20 +-
 .../display/dc/dml/dml1_display_rq_dlg_calc.c | 246 ++++++++---------
 .../display/dc/dml/dml1_display_rq_dlg_calc.h |  10 +-
 .../gpu/drm/amd/display/dc/inc/core_types.h   |   3 +
 18 files changed, 695 insertions(+), 689 deletions(-)

-- 
2.33.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/4] Fix stack usage of DML
  2021-09-09  1:00 Harry Wentland
  2021-09-09  8:04 ` Christian König
  2021-09-09 21:53 ` Nathan Chancellor
@ 2021-09-15 21:58 ` Leo Li
  2 siblings, 0 replies; 5+ messages in thread
From: Leo Li @ 2021-09-15 21:58 UTC (permalink / raw)
  To: Harry Wentland, amd-gfx
  Cc: ndesaulniers, torvalds, linux-kernel, arnd, alexander.deucher,
	christian.koenig, Xinhui.Pan, nathan, linux, llvm



On 2021-09-08 21:00, Harry Wentland wrote:
> With the '-Werror' enablement patch the amdgpu build was failing
> on clang builds because a bunch of functions were blowing past
> the 1024 byte stack frame default. Due to this we also noticed
> that a lot of functions were passing large structs by value
> instead of by pointer.
> 
> This series attempts to fix this.
> 
> There is still one remaining function that blows the 1024 limit by 40 bytes:
> 
> drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn21/display_mode_vba_21.c:3397:6:
>   
> error: stack frame size of 1064 bytes in function
> 'dml21_ModeSupportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than=]
> 
> This will be a slightly more challenging fix but I'll see if we can get it
> below 1024 by breaking it into smaller functions.
> 
> With this series I can build amdgpu with CC=clang and a stack frame limit of
> 1064.
> 
> This series boots on a Radeon RX 5500 XT.
> 
> Harry Wentland (4):
>    drm/amd/display: Pass display_pipe_params_st as const in DML
>    drm/amd/display: Pass all structs in display_rq_dlg_helpers by pointer
>    drm/amd/display: Fix rest of pass-by-value structs in DML
>    drm/amd/display: Allocate structs needed by dcn_bw_calc_rq_dlg_ttu in
>      pipe_ctx

Series LGTM,

Reviewed-by: Leo Li <sunpeng.li@amd.com>

Thanks!

> 
>   .../gpu/drm/amd/display/dc/calcs/dcn_calcs.c  |  55 ++--
>   .../drm/amd/display/dc/dcn20/dcn20_resource.c |   2 +-
>   .../dc/dml/dcn20/display_rq_dlg_calc_20.c     | 158 +++++------
>   .../dc/dml/dcn20/display_rq_dlg_calc_20.h     |   4 +-
>   .../dc/dml/dcn20/display_rq_dlg_calc_20v2.c   | 156 +++++------
>   .../dc/dml/dcn20/display_rq_dlg_calc_20v2.h   |   4 +-
>   .../dc/dml/dcn21/display_rq_dlg_calc_21.c     | 156 +++++------
>   .../dc/dml/dcn21/display_rq_dlg_calc_21.h     |   4 +-
>   .../dc/dml/dcn30/display_rq_dlg_calc_30.c     | 132 ++++-----
>   .../dc/dml/dcn30/display_rq_dlg_calc_30.h     |   4 +-
>   .../dc/dml/dcn31/display_rq_dlg_calc_31.c     | 166 ++++++------
>   .../dc/dml/dcn31/display_rq_dlg_calc_31.h     |   4 +-
>   .../drm/amd/display/dc/dml/display_mode_lib.h |   4 +-
>   .../display/dc/dml/display_rq_dlg_helpers.c   | 256 +++++++++---------
>   .../display/dc/dml/display_rq_dlg_helpers.h   |  20 +-
>   .../display/dc/dml/dml1_display_rq_dlg_calc.c | 246 ++++++++---------
>   .../display/dc/dml/dml1_display_rq_dlg_calc.h |  10 +-
>   .../gpu/drm/amd/display/dc/inc/core_types.h   |   3 +
>   18 files changed, 695 insertions(+), 689 deletions(-)
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/4] Fix stack usage of DML
  2021-09-09  1:00 Harry Wentland
  2021-09-09  8:04 ` Christian König
@ 2021-09-09 21:53 ` Nathan Chancellor
  2021-09-15 21:58 ` Leo Li
  2 siblings, 0 replies; 5+ messages in thread
From: Nathan Chancellor @ 2021-09-09 21:53 UTC (permalink / raw)
  To: Harry Wentland
  Cc: amd-gfx, ndesaulniers, torvalds, linux-kernel, arnd, sunpeng.li,
	alexander.deucher, christian.koenig, Xinhui.Pan, linux, llvm

On Wed, Sep 08, 2021 at 09:00:19PM -0400, Harry Wentland wrote:
> With the '-Werror' enablement patch the amdgpu build was failing
> on clang builds because a bunch of functions were blowing past
> the 1024 byte stack frame default. Due to this we also noticed
> that a lot of functions were passing large structs by value
> instead of by pointer.
> 
> This series attempts to fix this.
> 
> There is still one remaining function that blows the 1024 limit by 40 bytes:
> 
> drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn21/display_mode_vba_21.c:3397:6:
>  
> error: stack frame size of 1064 bytes in function 
> 'dml21_ModeSupportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than=]
> 
> This will be a slightly more challenging fix but I'll see if we can get it
> below 1024 by breaking it into smaller functions.
> 
> With this series I can build amdgpu with CC=clang and a stack frame limit of 
> 1064.
> 
> This series boots on a Radeon RX 5500 XT.
> 
> Harry Wentland (4):
>   drm/amd/display: Pass display_pipe_params_st as const in DML
>   drm/amd/display: Pass all structs in display_rq_dlg_helpers by pointer
>   drm/amd/display: Fix rest of pass-by-value structs in DML
>   drm/amd/display: Allocate structs needed by dcn_bw_calc_rq_dlg_ttu in
>     pipe_ctx

This series resolves some warnings that were reported on our issue
tracker for 32-bit x86. I do see some other warnings in amdgpu with
clang in various configurations but this is a great start. Thank you for
taking a look at them. For the series:

Build-tested-by: Nathan Chancellor <nathan@kernel.org>

>  .../gpu/drm/amd/display/dc/calcs/dcn_calcs.c  |  55 ++--
>  .../drm/amd/display/dc/dcn20/dcn20_resource.c |   2 +-
>  .../dc/dml/dcn20/display_rq_dlg_calc_20.c     | 158 +++++------
>  .../dc/dml/dcn20/display_rq_dlg_calc_20.h     |   4 +-
>  .../dc/dml/dcn20/display_rq_dlg_calc_20v2.c   | 156 +++++------
>  .../dc/dml/dcn20/display_rq_dlg_calc_20v2.h   |   4 +-
>  .../dc/dml/dcn21/display_rq_dlg_calc_21.c     | 156 +++++------
>  .../dc/dml/dcn21/display_rq_dlg_calc_21.h     |   4 +-
>  .../dc/dml/dcn30/display_rq_dlg_calc_30.c     | 132 ++++-----
>  .../dc/dml/dcn30/display_rq_dlg_calc_30.h     |   4 +-
>  .../dc/dml/dcn31/display_rq_dlg_calc_31.c     | 166 ++++++------
>  .../dc/dml/dcn31/display_rq_dlg_calc_31.h     |   4 +-
>  .../drm/amd/display/dc/dml/display_mode_lib.h |   4 +-
>  .../display/dc/dml/display_rq_dlg_helpers.c   | 256 +++++++++---------
>  .../display/dc/dml/display_rq_dlg_helpers.h   |  20 +-
>  .../display/dc/dml/dml1_display_rq_dlg_calc.c | 246 ++++++++---------
>  .../display/dc/dml/dml1_display_rq_dlg_calc.h |  10 +-
>  .../gpu/drm/amd/display/dc/inc/core_types.h   |   3 +
>  18 files changed, 695 insertions(+), 689 deletions(-)
> 
> -- 
> 2.33.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/4] Fix stack usage of DML
  2021-09-09  1:00 Harry Wentland
@ 2021-09-09  8:04 ` Christian König
  2021-09-09 21:53 ` Nathan Chancellor
  2021-09-15 21:58 ` Leo Li
  2 siblings, 0 replies; 5+ messages in thread
From: Christian König @ 2021-09-09  8:04 UTC (permalink / raw)
  To: Harry Wentland, amd-gfx
  Cc: ndesaulniers, torvalds, linux-kernel, arnd, sunpeng.li,
	alexander.deucher, christian.koenig, Xinhui.Pan, nathan, linux,
	llvm

It's nice to see at least some of them addressed, feel free to add an 
Acked-by: Christian König <christian.koenig@amd.com>

Regards,
Christian.

Am 09.09.21 um 03:00 schrieb Harry Wentland:
> With the '-Werror' enablement patch the amdgpu build was failing
> on clang builds because a bunch of functions were blowing past
> the 1024 byte stack frame default. Due to this we also noticed
> that a lot of functions were passing large structs by value
> instead of by pointer.
>
> This series attempts to fix this.
>
> There is still one remaining function that blows the 1024 limit by 40 bytes:
>
> drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn21/display_mode_vba_21.c:3397:6:
>   
> error: stack frame size of 1064 bytes in function
> 'dml21_ModeSupportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than=]
>
> This will be a slightly more challenging fix but I'll see if we can get it
> below 1024 by breaking it into smaller functions.
>
> With this series I can build amdgpu with CC=clang and a stack frame limit of
> 1064.
>
> This series boots on a Radeon RX 5500 XT.
>
> Harry Wentland (4):
>    drm/amd/display: Pass display_pipe_params_st as const in DML
>    drm/amd/display: Pass all structs in display_rq_dlg_helpers by pointer
>    drm/amd/display: Fix rest of pass-by-value structs in DML
>    drm/amd/display: Allocate structs needed by dcn_bw_calc_rq_dlg_ttu in
>      pipe_ctx
>
>   .../gpu/drm/amd/display/dc/calcs/dcn_calcs.c  |  55 ++--
>   .../drm/amd/display/dc/dcn20/dcn20_resource.c |   2 +-
>   .../dc/dml/dcn20/display_rq_dlg_calc_20.c     | 158 +++++------
>   .../dc/dml/dcn20/display_rq_dlg_calc_20.h     |   4 +-
>   .../dc/dml/dcn20/display_rq_dlg_calc_20v2.c   | 156 +++++------
>   .../dc/dml/dcn20/display_rq_dlg_calc_20v2.h   |   4 +-
>   .../dc/dml/dcn21/display_rq_dlg_calc_21.c     | 156 +++++------
>   .../dc/dml/dcn21/display_rq_dlg_calc_21.h     |   4 +-
>   .../dc/dml/dcn30/display_rq_dlg_calc_30.c     | 132 ++++-----
>   .../dc/dml/dcn30/display_rq_dlg_calc_30.h     |   4 +-
>   .../dc/dml/dcn31/display_rq_dlg_calc_31.c     | 166 ++++++------
>   .../dc/dml/dcn31/display_rq_dlg_calc_31.h     |   4 +-
>   .../drm/amd/display/dc/dml/display_mode_lib.h |   4 +-
>   .../display/dc/dml/display_rq_dlg_helpers.c   | 256 +++++++++---------
>   .../display/dc/dml/display_rq_dlg_helpers.h   |  20 +-
>   .../display/dc/dml/dml1_display_rq_dlg_calc.c | 246 ++++++++---------
>   .../display/dc/dml/dml1_display_rq_dlg_calc.h |  10 +-
>   .../gpu/drm/amd/display/dc/inc/core_types.h   |   3 +
>   18 files changed, 695 insertions(+), 689 deletions(-)
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 0/4] Fix stack usage of DML
@ 2021-09-09  1:00 Harry Wentland
  2021-09-09  8:04 ` Christian König
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Harry Wentland @ 2021-09-09  1:00 UTC (permalink / raw)
  To: amd-gfx
  Cc: ndesaulniers, torvalds, linux-kernel, arnd, sunpeng.li,
	alexander.deucher, christian.koenig, Xinhui.Pan, nathan, linux,
	llvm, Harry Wentland

With the '-Werror' enablement patch the amdgpu build was failing
on clang builds because a bunch of functions were blowing past
the 1024 byte stack frame default. Due to this we also noticed
that a lot of functions were passing large structs by value
instead of by pointer.

This series attempts to fix this.

There is still one remaining function that blows the 1024 limit by 40 bytes:

drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn21/display_mode_vba_21.c:3397:6:
 
error: stack frame size of 1064 bytes in function 
'dml21_ModeSupportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than=]

This will be a slightly more challenging fix but I'll see if we can get it
below 1024 by breaking it into smaller functions.

With this series I can build amdgpu with CC=clang and a stack frame limit of 
1064.

This series boots on a Radeon RX 5500 XT.

Harry Wentland (4):
  drm/amd/display: Pass display_pipe_params_st as const in DML
  drm/amd/display: Pass all structs in display_rq_dlg_helpers by pointer
  drm/amd/display: Fix rest of pass-by-value structs in DML
  drm/amd/display: Allocate structs needed by dcn_bw_calc_rq_dlg_ttu in
    pipe_ctx

 .../gpu/drm/amd/display/dc/calcs/dcn_calcs.c  |  55 ++--
 .../drm/amd/display/dc/dcn20/dcn20_resource.c |   2 +-
 .../dc/dml/dcn20/display_rq_dlg_calc_20.c     | 158 +++++------
 .../dc/dml/dcn20/display_rq_dlg_calc_20.h     |   4 +-
 .../dc/dml/dcn20/display_rq_dlg_calc_20v2.c   | 156 +++++------
 .../dc/dml/dcn20/display_rq_dlg_calc_20v2.h   |   4 +-
 .../dc/dml/dcn21/display_rq_dlg_calc_21.c     | 156 +++++------
 .../dc/dml/dcn21/display_rq_dlg_calc_21.h     |   4 +-
 .../dc/dml/dcn30/display_rq_dlg_calc_30.c     | 132 ++++-----
 .../dc/dml/dcn30/display_rq_dlg_calc_30.h     |   4 +-
 .../dc/dml/dcn31/display_rq_dlg_calc_31.c     | 166 ++++++------
 .../dc/dml/dcn31/display_rq_dlg_calc_31.h     |   4 +-
 .../drm/amd/display/dc/dml/display_mode_lib.h |   4 +-
 .../display/dc/dml/display_rq_dlg_helpers.c   | 256 +++++++++---------
 .../display/dc/dml/display_rq_dlg_helpers.h   |  20 +-
 .../display/dc/dml/dml1_display_rq_dlg_calc.c | 246 ++++++++---------
 .../display/dc/dml/dml1_display_rq_dlg_calc.h |  10 +-
 .../gpu/drm/amd/display/dc/inc/core_types.h   |   3 +
 18 files changed, 695 insertions(+), 689 deletions(-)

-- 
2.33.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-15 21:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-09  0:30 [PATCH 0/4] Fix stack usage of DML Harry Wentland
2021-09-09  1:00 Harry Wentland
2021-09-09  8:04 ` Christian König
2021-09-09 21:53 ` Nathan Chancellor
2021-09-15 21:58 ` Leo Li

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.