mlx5: work around high stack usage with gcc
Subsystems (5)
PATCH 1/1 mlx5: work around high stack usage with gcc
In some configurations, gcc tries too hard to optimize this code:
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c: In function 'mlx5e_grp_sw_update_stats':drivers/net/ethernet/mellanox/mlx5/core/en_stats.c:302:1: error: the frame size of 1336 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
As was stated in the bug report, the reason is that gcc runs into a corner case in the register allocator that is rather hard to fix in a good way.
As there is an easy way to work around it, just add a comment and the barrier that stops gcc from trying to overoptimize the function.
--- drivers/net/ethernet/mellanox/mlx5/core/en_stats.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c +3 -0
@@ -297,6 +297,9 @@ static void mlx5e_grp_sw_update_stats(struct mlx5e_priv *priv) s->tx_tls_drop_bypass_req += sq_stats->tls_drop_bypass_req;#endif s->tx_cqes += sq_stats->cqes; + +/* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92657 */ +barrier (); } } }
Signature · 1 line
2.20.0
From: Arnd Bergmann <[email protected]>
Date: Sat, 4 Jan 2020 22:51:44 +0100
Quoted 8 lines
In some configurations, gcc tries too hard to optimize this code:
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c: In function 'mlx5e_grp_sw_update_stats':drivers/net/ethernet/mellanox/mlx5/core/en_stats.c:302:1: error: the frame size of 1336 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]As was stated in the bug report, the reason is that gcc runs into a corner case in the register allocator that is rather hard to fix in a good way.
Quoted 6 lines
As there is an easy way to work around it, just add a comment and the barrier that stops gcc from trying to overoptimize the function.
Cc Adhemerval Zanella <[email protected]>Signed-off-by Arnd Bergmann <[email protected]>
Saeed, please take this.
Thank you.
Saeed Mahameed
AppliedQuoted 20 lines · David Miller
From: Arnd Bergmann <[email protected]>
Date: Sat, 4 Jan 2020 22:51:44 +0100Quoted 3 lines
In some configurations, gcc tries too hard to optimize this code:
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c: In function'
mlx5e_grp_sw_update_stats':Quoted 1 line
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c:302:1: error:the frame size of 1336 bytes is larger than 1024 bytes [- Werror=frame-larger-than=]
Quoted 2 lines
As was stated in the bug report, the reason is that gcc runs into a
corner
Quoted 1 line
case in the register allocator that is rather hard to fix in a good
way.
Quoted 2 lines
As there is an easy way to work around it, just add a comment and
the
Quoted 2 lines
barrier that stops gcc from trying to overoptimize the function.
Quoted 8 lines
Quoted 3 lines
Cc Adhemerval Zanella <[email protected]>Signed-off-by Arnd Bergmann <[email protected]>Saeed, please take this.
Thank you.
Applied to net-next-mlx5
will submit to net-next later today.
Thanks !