Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E8C4C76186 for ; Wed, 24 Jul 2019 22:47:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 767682189F for ; Wed, 24 Jul 2019 22:47:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729565AbfGXWrH (ORCPT ); Wed, 24 Jul 2019 18:47:07 -0400 Received: from shards.monkeyblade.net ([23.128.96.9]:53120 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728048AbfGXWrH (ORCPT ); Wed, 24 Jul 2019 18:47:07 -0400 Received: from localhost (unknown [IPv6:2601:601:9f80:35cd::d71]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 18C311543C8D5; Wed, 24 Jul 2019 15:47:06 -0700 (PDT) Date: Wed, 24 Jul 2019 15:47:05 -0700 (PDT) Message-Id: <20190724.154705.141831380224703229.davem@davemloft.net> To: arnd@arndb.de Cc: tariqt@mellanox.com, ereza@mellanox.com, jackm@dev.mellanox.co.il, eli@mellanox.co.il, moshe@mellanox.com, jiri@mellanox.com, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Subject: Re: [PATCH net-next] [net-next] mlx4: avoid large stack usage in mlx4_init_hca() From: David Miller In-Reply-To: <20190722150204.1157315-1-arnd@arndb.de> References: <20190722150204.1157315-1-arnd@arndb.de> X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Wed, 24 Jul 2019 15:47:06 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann Date: Mon, 22 Jul 2019 17:01:55 +0200 > The mlx4_dev_cap and mlx4_init_hca_param are really too large > to be put on the kernel stack, as shown by this clang warning: > > drivers/net/ethernet/mellanox/mlx4/main.c:3304:12: error: stack frame size of 1088 bytes in function 'mlx4_load_one' [-Werror,-Wframe-larger-than=] > > With gcc, the problem is the same, but it does not warn because > it does not inline this function, and therefore stays just below > the warning limit, while clang is just above it. > > Use kzalloc for dynamic allocation instead of putting them > on stack. This gets the combined stack frame down to 424 bytes. > > Signed-off-by: Arnd Bergmann Applied.