[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250612090525.GT10669@unreal>
Date: Thu, 12 Jun 2025 12:05:25 +0300
From: Leon Romanovsky <leon@...nel.org>
To: Arnd Bergmann <arnd@...nel.org>, Patrisious Haddad <phaddad@...dia.com>
Cc: Jason Gunthorpe <jgg@...pe.ca>, Arnd Bergmann <arnd@...db.de>,
Christian Göttsche <cgzones@...glemail.com>,
Serge Hallyn <serge@...lyn.com>,
Chiara Meiohas <cmeiohas@...dia.com>,
Al Viro <viro@...iv.linux.org.uk>, linux-rdma@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] RDMA/mlx5: reduce stack usage in mlx5_ib_ufile_hw_cleanup
On Tue, Jun 10, 2025 at 11:28:42AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
>
> This function has an array of eight mlx5_async_cmd structures, which
> often fits on the stack, but depending on the configuration can
> end up blowing the stack frame warning limit:
>
> drivers/infiniband/hw/mlx5/devx.c:2670:6: error: stack frame size (1392) exceeds limit (1280) in 'mlx5_ib_ufile_hw_cleanup' [-Werror,-Wframe-larger-than]
>
> Change this to a dynamic allocation instead. While a kmalloc()
> can theoretically fail, a GFP_KERNEL allocation under a page will
> block until memory has been freed up, so in the worst case, this
> only adds extra time in an already constrained environment.
>
> Fixes: 7c891a4dbcc1 ("RDMA/mlx5: Add implementation for ufile_hw_cleanup device operation")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
> drivers/infiniband/hw/mlx5/devx.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
<...>
> + async_cmd = kcalloc(MAX_ASYNC_CMDS, sizeof(*async_cmd), GFP_KERNEL);
> + if (WARN_ON(!async_cmd))
> + return;
Patrisious,
I took this patch for now (without WARN_ON) as it fixes Arnd's issue.
We can provide followup patch if kcalloc() implementation hurts us.
Thanks
Powered by blists - more mailing lists