* [PATCH] mlx5: work around high stack usage with gcc
@ 2020-01-04 21:51 Arnd Bergmann
2020-01-06 21:34 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2020-01-04 21:51 UTC (permalink / raw)
To: Saeed Mahameed, Leon Romanovsky, David S. Miller
Cc: Arnd Bergmann, Adhemerval Zanella, Tariq Toukan, Shay Agroskin,
Eran Ben Elisha, Maxim Mikityanskiy, Aya Levin, Moshe Shemesh,
netdev, linux-rdma, linux-kernel
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.
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92657
Cc: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
index 9f09253f9f46..a05158472ed1 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
@@ -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();
}
}
}
--
2.20.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mlx5: work around high stack usage with gcc
2020-01-04 21:51 [PATCH] mlx5: work around high stack usage with gcc Arnd Bergmann
@ 2020-01-06 21:34 ` David Miller
2020-01-06 21:59 ` Saeed Mahameed
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2020-01-06 21:34 UTC (permalink / raw)
To: arnd
Cc: saeedm, leon, adhemerval.zanella, tariqt, shayag, eranbe,
maximmi, ayal, moshe, netdev, linux-rdma, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
Date: Sat, 4 Jan 2020 22:51:44 +0100
> 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.
>
> Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92657
> Cc: Adhemerval Zanella <adhemerval.zanella@linaro.org>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Saeed, please take this.
Thank you.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mlx5: work around high stack usage with gcc
2020-01-06 21:34 ` David Miller
@ 2020-01-06 21:59 ` Saeed Mahameed
0 siblings, 0 replies; 3+ messages in thread
From: Saeed Mahameed @ 2020-01-06 21:59 UTC (permalink / raw)
To: davem, arnd
Cc: Aya Levin, Shay Agroskin, Moshe Shemesh, Tariq Toukan,
Maxim Mikityanskiy, linux-kernel, Eran Ben Elisha, netdev,
linux-rdma, leon, adhemerval.zanella
On Mon, 2020-01-06 at 13:34 -0800, David Miller wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> Date: Sat, 4 Jan 2020 22:51:44 +0100
>
> > 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.
> >
> > Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92657
> > Cc: Adhemerval Zanella <adhemerval.zanella@linaro.org>
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> Saeed, please take this.
>
> Thank you.
>
Applied to net-next-mlx5
will submit to net-next later today.
Thanks !
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-01-06 21:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-04 21:51 [PATCH] mlx5: work around high stack usage with gcc Arnd Bergmann
2020-01-06 21:34 ` David Miller
2020-01-06 21:59 ` Saeed Mahameed
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).