Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp4838973imb; Thu, 7 Mar 2019 01:35:24 -0800 (PST) X-Google-Smtp-Source: APXvYqxYBYjGevdQ+BvV3027Rz/ezaa31hbt6sWCQx8FfdskZ/2RyZD3/ELI4XACswFHhXxZPa91 X-Received: by 2002:a63:2a86:: with SMTP id q128mr10598345pgq.424.1551951324889; Thu, 07 Mar 2019 01:35:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551951324; cv=none; d=google.com; s=arc-20160816; b=mzYNrOTYrkSzo83lVjrppNkHK7KP8IqIeOXcIBLHGMbCbkfNACRLXx7+iYTxaVB6x+ dJVtzgTzoNyVlCbZg27cZN05PnNTBX5+XOs3PBArfQg7fbBNIWxKqJNIHnD22xePiIc1 fO/OwmKBAJgJxWOp+TrzU2Q8Uy4K0q3OD1X/hCW3VdpkwUwgkNw1yfxz1a7uqlM/qj6J wuz3vJohB7znbGG4Vg8pPl9b6kuTWYwUKA2vgDLyTG/ABXa4ZEEgPyotHgjlBHf1+N9n sOW838T6KIBo9VE2csTUXxK0Q5CFSQK2hLTjGsHoqT+bkVmffmMk1OLE0hp7Y8gKoY6r QfNA== 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=ichhNHuLL2fUpoRTtqPyzaLTcgpkkrHIqK31OyvIfBs=; b=ksYj3I3XQQMVsAody0KN3omU3QsIQepQFw0J4XCVu627AtIyX6Iz/m1p/zxWLuoo4q MEFa0lcdD9Y+F2I2JcMpwkNhvsP18QIScyxkhyDy7k+LhajaDxx8SPppOcaF1khHbDun jrtUkXEnClDxc5trROAn8zmEEqQTsxCt48kZEpkj+bv+8DSEsiu9WH3N3KTCVXdNqbcy gtR/jqrfPruRc5Ra1MNi3I1ls4ZB1Rpy03kHsDSau+w3Ha2FGXxvxFJSQDR0sbZk2Ylv m6p5brCaYU6TSWS4c296HmRh/37BKrd/5/XgVDssgiP6QkQAvqO88aQENU26sPrudS11 tQDQ== 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 e10si1381126pgo.404.2019.03.07.01.35.08; Thu, 07 Mar 2019 01:35:24 -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 S1726270AbfCGJeg (ORCPT + 99 others); Thu, 7 Mar 2019 04:34:36 -0500 Received: from mout.kundenserver.de ([212.227.126.130]:59717 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725747AbfCGJeg (ORCPT ); Thu, 7 Mar 2019 04:34:36 -0500 Received: from wuerfel.lan ([109.192.41.194]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1MoNMu-1ghsoJ3rnU-00ooKz; Thu, 07 Mar 2019 10:34:16 +0100 From: Arnd Bergmann To: "David S. Miller" , Florian Fainelli , Jakub Kicinski , Jiri Pirko Cc: Nick Desaulniers , Arnd Bergmann , Kees Cook , Wenwen Wang , Ilya Lesokhin , Pablo Neira Ayuso , Edward Cree , Michal Kubecek , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ethtool: reduce stack usage with clang Date: Thu, 7 Mar 2019 10:33:35 +0100 Message-Id: <20190307093408.3425010-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0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gK2WXhcav2zp05pcknVQ== 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 --- net/core/ethtool.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/net/core/ethtool.c b/net/core/ethtool.c index d4918ffddda8..fcbed78172a0 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; @@ -2533,7 +2535,7 @@ static int ethtool_set_fecparam(struct net_device *dev, void __user *useraddr) /* The main entry point in this file. Called from net/core/dev_ioctl.c */ -int dev_ethtool(struct net *net, struct ifreq *ifr) +int noinline_for_stack dev_ethtool(struct net *net, struct ifreq *ifr) { struct net_device *dev = __dev_get_by_name(net, ifr->ifr_name); void __user *useraddr = ifr->ifr_data; -- 2.20.0