blob: 487d65a018361b2519bce0e509f40b120afc2847 [file] [log] [blame]
From 4aa357ddd1255132e11ac64ce87e0e900fa40a73 Mon Sep 17 00:00:00 2001
From: Arnd Bergmann <>
Date: Sat, 4 Jan 2020 22:51:44 +0100
Subject: [PATCH] mlx5: work around high stack usage with gcc
commit 42ae1a5c76691928ed217c7e40269db27f5225e9 upstream.
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.
Cc: Adhemerval Zanella <>
Signed-off-by: Arnd Bergmann <>
Signed-off-by: Saeed Mahameed <>
Signed-off-by: Paul Gortmaker <>
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
index 483d321d2151..d12eb51e9d37 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
@@ -220,6 +220,9 @@ static void mlx5e_grp_sw_update_stats(struct mlx5e_priv *priv)
s->tx_tls_resync_bytes += sq_stats->tls_resync_bytes;
s->tx_cqes += sq_stats->cqes;
+ /* */
+ barrier();