[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a25MeyBgwZ9ZF2JbfpVChQuZ1wWc6VT1MFZ8-7haubVDw@mail.gmail.com>
Date: Thu, 30 Apr 2020 16:37:14 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Leon Romanovsky <leon@...nel.org>
Cc: Saeed Mahameed <saeedm@...lanox.com>,
"David S. Miller" <davem@...emloft.net>,
Moshe Shemesh <moshe@...lanox.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Networking <netdev@...r.kernel.org>,
linux-rdma <linux-rdma@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] net/mlx5: reduce stack usage in qp_read_field
On Thu, Apr 30, 2020 at 7:22 AM Leon Romanovsky <leon@...nel.org> wrote:
> On Tue, Apr 28, 2020 at 11:23:47PM +0200, Arnd Bergmann wrote:
> > Moving the mlx5_ifc_query_qp_out_bits structure on the stack was a bit
> > excessive and now causes the compiler to complain on 32-bit architectures:
> >
> > drivers/net/ethernet/mellanox/mlx5/core/debugfs.c: In function 'qp_read_field':
> > drivers/net/ethernet/mellanox/mlx5/core/debugfs.c:274:1: error: the frame size of 1104 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
> >
> > Revert the previous patch partially to use dynamically allocation as
> > the code did before. Unfortunately there is no good error handling
> > in case the allocation fails.
> >
> > Fixes: 57a6c5e992f5 ("net/mlx5: Replace hand written QP context struct with automatic getters")
> > Signed-off-by: Arnd Bergmann <arnd@...db.de>
> > ---
> > drivers/net/ethernet/mellanox/mlx5/core/debugfs.c | 12 +++++++++---
> > 1 file changed, 9 insertions(+), 3 deletions(-)
>
> Thanks Arnd, I'll pick it to mlx5-next.
>
> I was under impression that the frame size was increased a long
> time ago. Is this 1K limit still effective for all archs?
> Or is it is 32-bit leftover?
I got the output on a 32-bit build, but that doesn't make the code
right on 64-bit.
While warning limit is generally 1024 bytes for 32-bit architectures,
and 2048 bytes fro 64-bit architectures, we should probably
reduce the latter to something like 1280 bytes and fix up the
warnings that introduces.
Generally speaking, I'd say a function using more than a few hundred
bytes tends to be a bad idea, but we can't warn about those without
also warning about the handful of cases that do it for a good reason
and using close to 1024 bytes on 32 bit systems or a little more on
64-bit systems, in places that are known not to have deep call chains.
Arnd
Powered by blists - more mailing lists