From: David Laight <David.Laight@ACULAB.COM>
To: 'Arnd Bergmann' <arnd@arndb.de>,
Saeed Mahameed <saeedm@mellanox.com>,
Leon Romanovsky <leon@kernel.org>,
"David S. Miller" <davem@davemloft.net>
Cc: Tariq Toukan <tariqt@mellanox.com>,
Eran Ben Elisha <eranbe@mellanox.com>,
Boris Pismenny <borisp@mellanox.com>,
Ilya Lesokhin <ilyal@mellanox.com>,
Moshe Shemesh <moshe@mellanox.com>,
Kamal Heib <kamalh@mellanox.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] net/mlx5e: fix high stack usage
Date: Mon, 5 Nov 2018 11:24:06 +0000 [thread overview]
Message-ID: <ee55a08ca81149a598aef8c47367f856@AcuMS.aculab.com> (raw)
In-Reply-To: <20181102153316.1492515-1-arnd@arndb.de>
From: Arnd Bergmann
> Sent: 02 November 2018 15:33
>
> A patch that looks harmless causes the stack usage of the mlx5e_grp_sw_update_stats()
> function to drastically increase with x86 gcc-4.9 and higher (tested up to 8.1):
>
> 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:216:1: warning: the frame size of 1276 bytes is
> larger than 500 bytes [-Wframe-larger-than=]
>
> By splitting out the loop body into a non-inlined function, the stack size goes
> back down to under 500 bytes.
I'd look at the generated code for the function.
It might be truly horrid.
I suspect that gcc allocates 'virtual registers' for all the
s->tx_... members and then writes them to 's' outside the loop.
Unfortunately there aren't enough real registers so all the
virtual ones get spilled to stack.
I've seen it do something similar (extra spills to stack) in the
ixgbe byte and packet counting.
I think it is really a gcc bug.
...
> + for (j = 0; j < priv->max_opened_tc; j++) {
> + struct mlx5e_sq_stats *sq_stats = &channel_stats->sq[j];
Try adding barrier() here.
> +
> + s->tx_packets += sq_stats->packets;
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
prev parent reply other threads:[~2018-11-05 11:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-02 15:33 [PATCH] net/mlx5e: fix high stack usage Arnd Bergmann
2018-11-02 16:08 ` Jason Gunthorpe
2018-11-02 16:23 ` Arnd Bergmann
2018-11-02 17:00 ` Jason Gunthorpe
2018-11-02 21:05 ` Saeed Mahameed
2018-11-02 21:39 ` Eric Dumazet
2018-11-02 22:07 ` Saeed Mahameed
2018-11-02 22:15 ` Arnd Bergmann
2018-11-03 0:52 ` Saeed Mahameed
2018-11-02 22:15 ` Jason Gunthorpe
2018-11-03 0:37 ` Saeed Mahameed
2018-11-05 11:24 ` David Laight [this message]
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=ee55a08ca81149a598aef8c47367f856@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=arnd@arndb.de \
--cc=borisp@mellanox.com \
--cc=davem@davemloft.net \
--cc=eranbe@mellanox.com \
--cc=ilyal@mellanox.com \
--cc=kamalh@mellanox.com \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=moshe@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=saeedm@mellanox.com \
--cc=tariqt@mellanox.com \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).