Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp5111172imb; Thu, 7 Mar 2019 08:01:43 -0800 (PST) X-Google-Smtp-Source: APXvYqyQT00zZ+3LHwgywY8dEwmuoFyTPijWn4EpEFGhuyS9o8o35uSs3QAY7f4ODvGwDZ9K75XE X-Received: by 2002:a62:484:: with SMTP id 126mr13381679pfe.91.1551974503650; Thu, 07 Mar 2019 08:01:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551974503; cv=none; d=google.com; s=arc-20160816; b=Crqs1kubTNJ+KdQGaIHwSWSvUVejumC8uUDluNwAmCB5XBei2aPxZYW7OpPut0/lfj 8kYJFXcbjL+vcV76MI7nkb8ta48EI4JjA3iXYGacUyfJJ+KVNHhfQ83q10AlhHlN2Mje 9V/azFgFrHHCU0vPw6kSsRv0Q/c2/ACDu30ZL/0C3epVfdvtzOxcuhufz4N/L+bpm0n2 sXv+4aYkJfLayBU48SyDltYWNbONQOj+M6DcWarc87FYPkt0JI6/nyEdteSDxKk65Ov5 Y05cbEFTLSML4drpTOuhwAdybvqIMpgZBPn4hHZAs6noftuwtF3k4Ej/EkMtyIxo+hHa nRAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=TKZZ3DoeeQKQprZG7e+JWFBPDjZiqnOX/rcd4v9E9yM=; b=mdQLK6uG8gEDPMMzPMywuquxsB/S0+LYaOfQEYGdSJDCEt5I5BcT6uCrmADnm8j5Xj u1G2okh1FmiRt2BYd9a0awlPPaaiKIfP+Psd4x0rKdmIddvT4+WptSE2a+ZxpGTbpKH9 7npehGMLCZtRxzdJn8jCpOh61zPDtWVi8dFVPDnSzfoaymUB8WZkZEPAUp3F4t9X6BWr JSNldTjhilXPJR5GwVi9wcGPXn1JmM7thIRTutDO08dDxjvGgvbNVkT3cSZz7IwM5v+X U2KM0chfLbg9zmyKQ89pzySdcwGRqniFhiWOPFl+h5RIJx+XV94zlY0jQwkgJpy7FnE9 jTDA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x1si4454663plo.58.2019.03.07.08.01.27; Thu, 07 Mar 2019 08:01:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726590AbfCGQAl (ORCPT + 99 others); Thu, 7 Mar 2019 11:00:41 -0500 Received: from mout.kundenserver.de ([212.227.126.187]:35995 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726159AbfCGQAk (ORCPT ); Thu, 7 Mar 2019 11:00:40 -0500 Received: from wuerfel.lan ([109.192.41.194]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1MfL5v-1gZlkv3lSl-00gs6s; Thu, 07 Mar 2019 17:00:26 +0100 From: Arnd Bergmann To: "David S. Miller" Cc: Arnd Bergmann , Florian Fainelli , Jakub Kicinski , Jiri Pirko , Wenwen Wang , Michal Kubecek , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] [v2] ethtool: reduce stack usage with clang Date: Thu, 7 Mar 2019 16:58:35 +0100 Message-Id: <20190307160017.3120362-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:T2IDOyorbgsgPpj+Bqgq7HPPcnC7R+qzlnvnoj1X7TcTxjdySDI zUZqAMZ2WK3VCIVGfBHlgrFIEUlgcDCSazoE08hDgh6ahBC6cP8CCFRId4uFTDA0yyz5GVV fhjgtjkGgIz0T2t1cUSq9vZQVBM3jQD7T7FRyvoHOeglKsVoGWI2uLgWrmtK4k4hzJLCynU 7O6UE/gzzy14hkOMjclzw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:M8mJxqWzkoo=:dx+1+v6weoaqHui1MVb2w9 XKlalBcOz+yGzVOqhaVoAr8gvjnwDPXzMMWpkPsP4rsckKA1q+tBqBZilIBWISce754bCwx0P fTL9Qqj2ODSlLE1kyXJdFSzgLJCwsXLU99QwJAh5OL7eeP4HnVzY3Jzj55xtZYkXuXkikcn3j g2N/XMp9vaIllMmzHZD3i+SXkMCXOw4gnWsB6qyHOQhbA/IUjlaHgexPo8TDnlevYhdU44WFO E2EcBXwlPaheZ+C89iXmwkdMgS0Wz1nzSdzpH1H9bsnh578wFkhvoTSSwidj8y5qbjdIxyGsL qhvRTx+KRNyhC1WFbArMmbL0MkQWRFwLtn4GGc0e159wKxBp7ef/iGUpu5tufI2Kkm11Z5R7s JTUIdGm6S9Su8nYJQ+pRacQ3okDSU+qdUyU3XFYmoutl87tchUpIvTVrM5bEglnhnkbpSuYKr sadmFUq+6KZB1SmYRZD1PfFYTjhxIsZ6fDPY53lev4AUrHkd77CW4Y5cpTCzZXgbZ6Gjt38YL HVis3cZUOl6yPZuAVkr6esdi5n9GHzrScHzOxBmIamMltA0d7TKDYkr5y0/wOpb4u1YlHHL04 Dlm5vepNoZfCCwofvpOU5M2QvAwIi0KKSpWw2xD0WpEpBj2gBQlDnomIKykA2Lf51tZoGhClJ H9yl/35o6EsWcFQf2IYgDZBmyeF2PurPiSsth3+UD5M7L/Q/Nr7/tYAoMpocH8dWX1SVVZuVp P5LljWTwfEnRDprZv9eeMIMl6d8JRJLk4/4F9A== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org clang inlines the dev_ethtool() more aggressively than gcc does, leading to a larger amount of used stack space: net/core/ethtool.c:2536:24: error: stack frame size of 1216 bytes in function 'dev_ethtool' [-Werror,-Wframe-larger-than=] Marking the sub-functions that require the most stack space as noinline_for_stack gives us reasonable behavior on all compilers. Signed-off-by: Arnd Bergmann --- v2: don't annotate dev_ethtool itself, as pointed out by Michal Kubecek --- net/core/ethtool.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/net/core/ethtool.c b/net/core/ethtool.c index d4918ffddda8..b1eb32419732 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c @@ -2319,9 +2319,10 @@ static int ethtool_set_tunable(struct net_device *dev, void __user *useraddr) return ret; } -static int ethtool_get_per_queue_coalesce(struct net_device *dev, - void __user *useraddr, - struct ethtool_per_queue_op *per_queue_opt) +static noinline_for_stack int +ethtool_get_per_queue_coalesce(struct net_device *dev, + void __user *useraddr, + struct ethtool_per_queue_op *per_queue_opt) { u32 bit; int ret; @@ -2349,9 +2350,10 @@ static int ethtool_get_per_queue_coalesce(struct net_device *dev, return 0; } -static int ethtool_set_per_queue_coalesce(struct net_device *dev, - void __user *useraddr, - struct ethtool_per_queue_op *per_queue_opt) +static noinline_for_stack int +ethtool_set_per_queue_coalesce(struct net_device *dev, + void __user *useraddr, + struct ethtool_per_queue_op *per_queue_opt) { u32 bit; int i, ret = 0; @@ -2405,7 +2407,7 @@ static int ethtool_set_per_queue_coalesce(struct net_device *dev, return ret; } -static int ethtool_set_per_queue(struct net_device *dev, +static int noinline_for_stack ethtool_set_per_queue(struct net_device *dev, void __user *useraddr, u32 sub_cmd) { struct ethtool_per_queue_op per_queue_opt; -- 2.20.0