From patchwork Thu Mar 7 15:58:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 159877 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp7598523jad; Thu, 7 Mar 2019 08:00:43 -0800 (PST) X-Google-Smtp-Source: APXvYqz61b/hti1ZVLX39nVyQagXYYM1LG28X/6t2lNAmMi4exP3R3wi3IFacsbUBKoIbAYGVoF1 X-Received: by 2002:a63:89c7:: with SMTP id v190mr11349532pgd.370.1551974443860; Thu, 07 Mar 2019 08:00:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551974443; cv=none; d=google.com; s=arc-20160816; b=b8811w0f+psA+iWPTqyci5/PhUQLo1E8ryorzbgOI0TYvC6vOiVAQiS3K3fHeJtP9e bSDwDvwRYSbj+Ig42XQxwVBFTHBy9Morrk/6lgI+WSrTIouIPcUolzHoJyHZYEly4t0I O4AaNUiUXRoauaGRqbgUZ7I+uyh/NVqZlSt5ZMfS9tQHEIWbagWpsmwBlorscMJNj8fg RwjHn6ikU9ev0TTHHA8oObk+gfem0y27rd2QrSFgmMiAKgA64GgPrw1oO2ap19HFOm5B xJcCVwvqqTjcxHV0hxU8ismIh/zhdAXHwJOn8tnt3ZJWsL4iDx3Kxy3D/Fnkl3kG24ca OpUA== 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 f89si4077098plf.24.2019.03.07.08.00.43; Thu, 07 Mar 2019 08:00: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 S1726618AbfCGQAl (ORCPT + 31 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 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(-) -- 2.20.0 Reviewed-by: Michal Kubecek 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;